From a890dd0426fd33803d43ecfd99f76518a4830e78 Mon Sep 17 00:00:00 2001 From: SDKAuto Date: Thu, 16 Dec 2021 03:05:36 +0000 Subject: [PATCH] CodeGen from PR 17078 in Azure/azure-rest-api-specs Add ActionType according to arm-rpc (#17078) * Add ActionType according to arm-rpc * add stable API version --- .../azure-mgmt-appplatform/_meta.json | 10 +- .../_app_platform_management_client.py | 55 +- .../azure/mgmt/appplatform/_configuration.py | 4 +- .../aio/_app_platform_management_client.py | 56 +- .../mgmt/appplatform/aio/_configuration.py | 4 +- .../v2019_05_01_preview/__init__.py | 9 +- .../_app_platform_management_client.py | 115 +- .../v2019_05_01_preview/_configuration.py | 6 +- .../v2019_05_01_preview/_metadata.json | 21 +- .../appplatform/v2019_05_01_preview/_patch.py | 31 + .../v2019_05_01_preview/_vendor.py | 27 + .../v2019_05_01_preview/_version.py | 2 +- .../v2019_05_01_preview/aio/__init__.py | 5 + .../aio/_app_platform_management_client.py | 115 +- .../v2019_05_01_preview/aio/_configuration.py | 6 +- .../v2019_05_01_preview/aio/_patch.py | 31 + .../aio/operations/_apps_operations.py | 311 +- .../aio/operations/_bindings_operations.py | 220 +- .../operations/_certificates_operations.py | 171 +- .../operations/_custom_domains_operations.py | 264 +- .../aio/operations/_deployments_operations.py | 564 +-- .../aio/operations/_operations.py | 45 +- .../_runtime_versions_operations.py | 30 +- .../aio/operations/_services_operations.py | 499 +- .../aio/operations/_sku_operations.py | 56 +- .../v2019_05_01_preview/models/__init__.py | 2 + .../_app_platform_management_client_enums.py | 53 +- .../v2019_05_01_preview/models/_models.py | 1313 ++++-- .../v2019_05_01_preview/models/_models_py3.py | 1306 ++++-- .../operations/_apps_operations.py | 552 ++- .../operations/_bindings_operations.py | 429 +- .../operations/_certificates_operations.py | 328 +- .../operations/_custom_domains_operations.py | 515 ++- .../operations/_deployments_operations.py | 977 ++-- .../operations/_operations.py | 74 +- .../_runtime_versions_operations.py | 60 +- .../operations/_services_operations.py | 906 ++-- .../operations/_sku_operations.py | 91 +- .../mgmt/appplatform/v2020_07_01/__init__.py | 9 +- .../_app_platform_management_client.py | 117 +- .../appplatform/v2020_07_01/_configuration.py | 6 +- .../appplatform/v2020_07_01/_metadata.json | 21 +- .../mgmt/appplatform/v2020_07_01/_patch.py | 31 + .../mgmt/appplatform/v2020_07_01/_vendor.py | 27 + .../mgmt/appplatform/v2020_07_01/_version.py | 2 +- .../appplatform/v2020_07_01/aio/__init__.py | 5 + .../aio/_app_platform_management_client.py | 123 +- .../v2020_07_01/aio/_configuration.py | 6 +- .../appplatform/v2020_07_01/aio/_patch.py | 31 + .../aio/operations/_apps_operations.py | 375 +- .../aio/operations/_bindings_operations.py | 312 +- .../operations/_certificates_operations.py | 224 +- .../operations/_config_servers_operations.py | 252 +- .../operations/_custom_domains_operations.py | 312 +- .../aio/operations/_deployments_operations.py | 582 +-- .../_monitoring_settings_operations.py | 187 +- .../v2020_07_01/aio/operations/_operations.py | 45 +- .../_runtime_versions_operations.py | 30 +- .../aio/operations/_services_operations.py | 499 +- .../aio/operations/_skus_operations.py | 56 +- .../v2020_07_01/models/__init__.py | 2 + .../_app_platform_management_client_enums.py | 53 +- .../appplatform/v2020_07_01/models/_models.py | 1330 ++++-- .../v2020_07_01/models/_models_py3.py | 1323 ++++-- .../operations/_apps_operations.py | 652 ++- .../operations/_bindings_operations.py | 521 ++- .../operations/_certificates_operations.py | 381 +- .../operations/_config_servers_operations.py | 412 +- .../operations/_custom_domains_operations.py | 521 ++- .../operations/_deployments_operations.py | 995 ++-- .../_monitoring_settings_operations.py | 307 +- .../v2020_07_01/operations/_operations.py | 74 +- .../_runtime_versions_operations.py | 60 +- .../operations/_services_operations.py | 906 ++-- .../operations/_skus_operations.py | 91 +- .../v2020_11_01_preview/__init__.py | 9 +- .../_app_platform_management_client.py | 129 +- .../v2020_11_01_preview/_configuration.py | 6 +- .../v2020_11_01_preview/_metadata.json | 21 +- .../appplatform/v2020_11_01_preview/_patch.py | 31 + .../v2020_11_01_preview/_vendor.py | 27 + .../v2020_11_01_preview/_version.py | 2 +- .../v2020_11_01_preview/aio/__init__.py | 5 + .../aio/_app_platform_management_client.py | 129 +- .../v2020_11_01_preview/aio/_configuration.py | 6 +- .../v2020_11_01_preview/aio/_patch.py | 31 + .../aio/operations/_apps_operations.py | 378 +- .../aio/operations/_bindings_operations.py | 312 +- .../operations/_certificates_operations.py | 227 +- .../operations/_config_servers_operations.py | 261 +- .../operations/_custom_domains_operations.py | 312 +- .../aio/operations/_deployments_operations.py | 588 ++- .../_monitoring_settings_operations.py | 187 +- .../aio/operations/_operations.py | 45 +- .../_runtime_versions_operations.py | 30 +- .../aio/operations/_services_operations.py | 499 +- .../aio/operations/_skus_operations.py | 56 +- .../v2020_11_01_preview/models/__init__.py | 2 + .../_app_platform_management_client_enums.py | 53 +- .../v2020_11_01_preview/models/_models.py | 1377 ++++-- .../v2020_11_01_preview/models/_models_py3.py | 1370 ++++-- .../operations/_apps_operations.py | 661 ++- .../operations/_bindings_operations.py | 521 ++- .../operations/_certificates_operations.py | 384 +- .../operations/_config_servers_operations.py | 421 +- .../operations/_custom_domains_operations.py | 521 ++- .../operations/_deployments_operations.py | 1001 ++-- .../_monitoring_settings_operations.py | 307 +- .../operations/_operations.py | 74 +- .../_runtime_versions_operations.py | 60 +- .../operations/_services_operations.py | 906 ++-- .../operations/_skus_operations.py | 91 +- .../v2021_06_01_preview/__init__.py | 9 +- .../_app_platform_management_client.py | 129 +- .../v2021_06_01_preview/_configuration.py | 6 +- .../v2021_06_01_preview/_metadata.json | 21 +- .../appplatform/v2021_06_01_preview/_patch.py | 31 + .../v2021_06_01_preview/_vendor.py | 27 + .../v2021_06_01_preview/_version.py | 2 +- .../v2021_06_01_preview/aio/__init__.py | 5 + .../aio/_app_platform_management_client.py | 129 +- .../v2021_06_01_preview/aio/_configuration.py | 6 +- .../v2021_06_01_preview/aio/_patch.py | 31 + .../aio/operations/_apps_operations.py | 378 +- .../aio/operations/_bindings_operations.py | 312 +- .../operations/_certificates_operations.py | 227 +- .../operations/_config_servers_operations.py | 261 +- .../operations/_custom_domains_operations.py | 312 +- .../aio/operations/_deployments_operations.py | 588 ++- .../_monitoring_settings_operations.py | 187 +- .../aio/operations/_operations.py | 45 +- .../_runtime_versions_operations.py | 30 +- .../aio/operations/_services_operations.py | 499 +- .../aio/operations/_skus_operations.py | 56 +- .../v2021_06_01_preview/models/__init__.py | 2 + .../_app_platform_management_client_enums.py | 53 +- .../v2021_06_01_preview/models/_models.py | 1473 ++++-- .../v2021_06_01_preview/models/_models_py3.py | 1474 ++++-- .../operations/_apps_operations.py | 661 ++- .../operations/_bindings_operations.py | 521 ++- .../operations/_certificates_operations.py | 384 +- .../operations/_config_servers_operations.py | 421 +- .../operations/_custom_domains_operations.py | 521 ++- .../operations/_deployments_operations.py | 1001 ++-- .../_monitoring_settings_operations.py | 307 +- .../operations/_operations.py | 74 +- .../_runtime_versions_operations.py | 60 +- .../operations/_services_operations.py | 906 ++-- .../operations/_skus_operations.py | 91 +- .../v2021_09_01_preview/__init__.py | 18 + .../_app_platform_management_client.py | 137 + .../v2021_09_01_preview/_configuration.py | 71 + .../v2021_09_01_preview/_metadata.json | 113 + .../appplatform/v2021_09_01_preview/_patch.py | 31 + .../v2021_09_01_preview/_vendor.py | 27 + .../v2021_09_01_preview/_version.py | 9 + .../v2021_09_01_preview/aio/__init__.py | 15 + .../aio/_app_platform_management_client.py | 130 + .../v2021_09_01_preview/aio/_configuration.py | 67 + .../v2021_09_01_preview/aio/_patch.py | 31 + .../aio/operations/__init__.py | 35 + .../aio/operations/_apps_operations.py | 668 +++ .../aio/operations/_bindings_operations.py | 570 +++ .../operations/_certificates_operations.py | 416 ++ .../operations/_config_servers_operations.py | 468 ++ .../operations/_custom_domains_operations.py | 570 +++ .../aio/operations/_deployments_operations.py | 1413 ++++++ .../_monitoring_settings_operations.py | 345 ++ .../aio/operations/_operations.py | 109 + .../_runtime_versions_operations.py | 87 + .../aio/operations/_services_operations.py | 1042 +++++ .../aio/operations/_skus_operations.py | 112 + .../aio/operations/_storages_operations.py | 415 ++ .../v2021_09_01_preview/models/__init__.py | 309 ++ .../_app_platform_management_client_enums.py | 175 + .../v2021_09_01_preview/models/_models.py | 3761 +++++++++++++++ .../v2021_09_01_preview/models/_models_py3.py | 4072 +++++++++++++++++ .../operations/__init__.py | 35 + .../operations/_apps_operations.py | 965 ++++ .../operations/_bindings_operations.py | 791 ++++ .../operations/_certificates_operations.py | 583 +++ .../operations/_config_servers_operations.py | 639 +++ .../operations/_custom_domains_operations.py | 791 ++++ .../operations/_deployments_operations.py | 1984 ++++++++ .../_monitoring_settings_operations.py | 474 ++ .../operations/_operations.py | 143 + .../_runtime_versions_operations.py | 122 + .../operations/_services_operations.py | 1543 +++++++ .../operations/_skus_operations.py | 152 + .../operations/_storages_operations.py | 582 +++ .../appplatform/v2021_09_01_preview/py.typed | 1 + 191 files changed, 50649 insertions(+), 15795 deletions(-) create mode 100644 sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2019_05_01_preview/_patch.py create mode 100644 sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2019_05_01_preview/_vendor.py create mode 100644 sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2019_05_01_preview/aio/_patch.py create mode 100644 sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2020_07_01/_patch.py create mode 100644 sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2020_07_01/_vendor.py create mode 100644 sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2020_07_01/aio/_patch.py create mode 100644 sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2020_11_01_preview/_patch.py create mode 100644 sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2020_11_01_preview/_vendor.py create mode 100644 sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2020_11_01_preview/aio/_patch.py create mode 100644 sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2021_06_01_preview/_patch.py create mode 100644 sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2021_06_01_preview/_vendor.py create mode 100644 sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2021_06_01_preview/aio/_patch.py create mode 100644 sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2021_09_01_preview/__init__.py create mode 100644 sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2021_09_01_preview/_app_platform_management_client.py create mode 100644 sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2021_09_01_preview/_configuration.py create mode 100644 sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2021_09_01_preview/_metadata.json create mode 100644 sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2021_09_01_preview/_patch.py create mode 100644 sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2021_09_01_preview/_vendor.py create mode 100644 sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2021_09_01_preview/_version.py create mode 100644 sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2021_09_01_preview/aio/__init__.py create mode 100644 sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2021_09_01_preview/aio/_app_platform_management_client.py create mode 100644 sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2021_09_01_preview/aio/_configuration.py create mode 100644 sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2021_09_01_preview/aio/_patch.py create mode 100644 sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2021_09_01_preview/aio/operations/__init__.py create mode 100644 sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2021_09_01_preview/aio/operations/_apps_operations.py create mode 100644 sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2021_09_01_preview/aio/operations/_bindings_operations.py create mode 100644 sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2021_09_01_preview/aio/operations/_certificates_operations.py create mode 100644 sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2021_09_01_preview/aio/operations/_config_servers_operations.py create mode 100644 sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2021_09_01_preview/aio/operations/_custom_domains_operations.py create mode 100644 sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2021_09_01_preview/aio/operations/_deployments_operations.py create mode 100644 sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2021_09_01_preview/aio/operations/_monitoring_settings_operations.py create mode 100644 sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2021_09_01_preview/aio/operations/_operations.py create mode 100644 sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2021_09_01_preview/aio/operations/_runtime_versions_operations.py create mode 100644 sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2021_09_01_preview/aio/operations/_services_operations.py create mode 100644 sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2021_09_01_preview/aio/operations/_skus_operations.py create mode 100644 sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2021_09_01_preview/aio/operations/_storages_operations.py create mode 100644 sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2021_09_01_preview/models/__init__.py create mode 100644 sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2021_09_01_preview/models/_app_platform_management_client_enums.py create mode 100644 sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2021_09_01_preview/models/_models.py create mode 100644 sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2021_09_01_preview/models/_models_py3.py create mode 100644 sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2021_09_01_preview/operations/__init__.py create mode 100644 sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2021_09_01_preview/operations/_apps_operations.py create mode 100644 sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2021_09_01_preview/operations/_bindings_operations.py create mode 100644 sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2021_09_01_preview/operations/_certificates_operations.py create mode 100644 sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2021_09_01_preview/operations/_config_servers_operations.py create mode 100644 sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2021_09_01_preview/operations/_custom_domains_operations.py create mode 100644 sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2021_09_01_preview/operations/_deployments_operations.py create mode 100644 sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2021_09_01_preview/operations/_monitoring_settings_operations.py create mode 100644 sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2021_09_01_preview/operations/_operations.py create mode 100644 sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2021_09_01_preview/operations/_runtime_versions_operations.py create mode 100644 sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2021_09_01_preview/operations/_services_operations.py create mode 100644 sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2021_09_01_preview/operations/_skus_operations.py create mode 100644 sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2021_09_01_preview/operations/_storages_operations.py create mode 100644 sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2021_09_01_preview/py.typed diff --git a/sdk/appplatform/azure-mgmt-appplatform/_meta.json b/sdk/appplatform/azure-mgmt-appplatform/_meta.json index e087fa371e6d6..005cda4ba57d5 100644 --- a/sdk/appplatform/azure-mgmt-appplatform/_meta.json +++ b/sdk/appplatform/azure-mgmt-appplatform/_meta.json @@ -1,11 +1,11 @@ { - "autorest": "3.4.2", + "autorest": "3.7.2", "use": [ - "@autorest/python@5.8.1", - "@autorest/modelerfour@4.19.2" + "@autorest/python@5.12.0", + "@autorest/modelerfour@4.19.3" ], - "commit": "c803720c6bcfcb0fcf4c97f3463ec33a18f9e55c", + "commit": "79751e0389d7b753b5c119c8b2d796a02d3abd28", "repository_url": "https://github.com/Azure/azure-rest-api-specs", - "autorest_command": "autorest specification/appplatform/resource-manager/readme.md --multiapi --python --python-mode=update --python-sdks-folder=/home/vsts/work/1/s/azure-sdk-for-python/sdk --track2 --use=@autorest/python@5.8.1 --use=@autorest/modelerfour@4.19.2 --version=3.4.2", + "autorest_command": "autorest specification/appplatform/resource-manager/readme.md --multiapi --python --python-mode=update --python-sdks-folder=/home/vsts/work/1/s/azure-sdk-for-python/sdk --track2 --use=@autorest/python@5.12.0 --use=@autorest/modelerfour@4.19.3 --version=3.7.2", "readme": "specification/appplatform/resource-manager/readme.md" } \ No newline at end of file diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/_app_platform_management_client.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/_app_platform_management_client.py index b417f26cc70d6..2f2a9ad98ad52 100644 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/_app_platform_management_client.py +++ b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/_app_platform_management_client.py @@ -23,7 +23,6 @@ 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): @@ -71,12 +70,10 @@ def __init__( credential, # type: "TokenCredential" subscription_id, # type: str api_version=None, # type: Optional[str] - base_url=None, # type: Optional[str] + base_url="https://management.azure.com", # type: 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__( @@ -96,6 +93,7 @@ def models(cls, api_version=DEFAULT_API_VERSION): * 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` + * 2021-09-01-preview: :mod:`v2021_09_01_preview.models` """ if api_version == '2019-05-01-preview': from .v2019_05_01_preview import models @@ -109,6 +107,9 @@ def models(cls, api_version=DEFAULT_API_VERSION): elif api_version == '2021-06-01-preview': from .v2021_06_01_preview import models return models + elif api_version == '2021-09-01-preview': + from .v2021_09_01_preview import models + return models raise ValueError("API version {} is not available".format(api_version)) @property @@ -119,6 +120,7 @@ def apps(self): * 2020-07-01: :class:`AppsOperations` * 2020-11-01-preview: :class:`AppsOperations` * 2021-06-01-preview: :class:`AppsOperations` + * 2021-09-01-preview: :class:`AppsOperations` """ api_version = self._get_api_version('apps') if api_version == '2019-05-01-preview': @@ -129,6 +131,8 @@ def apps(self): from .v2020_11_01_preview.operations import AppsOperations as OperationClass elif api_version == '2021-06-01-preview': from .v2021_06_01_preview.operations import AppsOperations as OperationClass + elif api_version == '2021-09-01-preview': + from .v2021_09_01_preview.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))) @@ -141,6 +145,7 @@ def bindings(self): * 2020-07-01: :class:`BindingsOperations` * 2020-11-01-preview: :class:`BindingsOperations` * 2021-06-01-preview: :class:`BindingsOperations` + * 2021-09-01-preview: :class:`BindingsOperations` """ api_version = self._get_api_version('bindings') if api_version == '2019-05-01-preview': @@ -151,6 +156,8 @@ def bindings(self): from .v2020_11_01_preview.operations import BindingsOperations as OperationClass elif api_version == '2021-06-01-preview': from .v2021_06_01_preview.operations import BindingsOperations as OperationClass + elif api_version == '2021-09-01-preview': + from .v2021_09_01_preview.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))) @@ -163,6 +170,7 @@ def certificates(self): * 2020-07-01: :class:`CertificatesOperations` * 2020-11-01-preview: :class:`CertificatesOperations` * 2021-06-01-preview: :class:`CertificatesOperations` + * 2021-09-01-preview: :class:`CertificatesOperations` """ api_version = self._get_api_version('certificates') if api_version == '2019-05-01-preview': @@ -173,6 +181,8 @@ def certificates(self): from .v2020_11_01_preview.operations import CertificatesOperations as OperationClass elif api_version == '2021-06-01-preview': from .v2021_06_01_preview.operations import CertificatesOperations as OperationClass + elif api_version == '2021-09-01-preview': + from .v2021_09_01_preview.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))) @@ -184,6 +194,7 @@ def config_servers(self): * 2020-07-01: :class:`ConfigServersOperations` * 2020-11-01-preview: :class:`ConfigServersOperations` * 2021-06-01-preview: :class:`ConfigServersOperations` + * 2021-09-01-preview: :class:`ConfigServersOperations` """ api_version = self._get_api_version('config_servers') if api_version == '2020-07-01': @@ -192,6 +203,8 @@ def config_servers(self): from .v2020_11_01_preview.operations import ConfigServersOperations as OperationClass elif api_version == '2021-06-01-preview': from .v2021_06_01_preview.operations import ConfigServersOperations as OperationClass + elif api_version == '2021-09-01-preview': + from .v2021_09_01_preview.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))) @@ -204,6 +217,7 @@ def custom_domains(self): * 2020-07-01: :class:`CustomDomainsOperations` * 2020-11-01-preview: :class:`CustomDomainsOperations` * 2021-06-01-preview: :class:`CustomDomainsOperations` + * 2021-09-01-preview: :class:`CustomDomainsOperations` """ api_version = self._get_api_version('custom_domains') if api_version == '2019-05-01-preview': @@ -214,6 +228,8 @@ def custom_domains(self): from .v2020_11_01_preview.operations import CustomDomainsOperations as OperationClass elif api_version == '2021-06-01-preview': from .v2021_06_01_preview.operations import CustomDomainsOperations as OperationClass + elif api_version == '2021-09-01-preview': + from .v2021_09_01_preview.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))) @@ -226,6 +242,7 @@ def deployments(self): * 2020-07-01: :class:`DeploymentsOperations` * 2020-11-01-preview: :class:`DeploymentsOperations` * 2021-06-01-preview: :class:`DeploymentsOperations` + * 2021-09-01-preview: :class:`DeploymentsOperations` """ api_version = self._get_api_version('deployments') if api_version == '2019-05-01-preview': @@ -236,6 +253,8 @@ def deployments(self): from .v2020_11_01_preview.operations import DeploymentsOperations as OperationClass elif api_version == '2021-06-01-preview': from .v2021_06_01_preview.operations import DeploymentsOperations as OperationClass + elif api_version == '2021-09-01-preview': + from .v2021_09_01_preview.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))) @@ -247,6 +266,7 @@ def monitoring_settings(self): * 2020-07-01: :class:`MonitoringSettingsOperations` * 2020-11-01-preview: :class:`MonitoringSettingsOperations` * 2021-06-01-preview: :class:`MonitoringSettingsOperations` + * 2021-09-01-preview: :class:`MonitoringSettingsOperations` """ api_version = self._get_api_version('monitoring_settings') if api_version == '2020-07-01': @@ -255,6 +275,8 @@ def monitoring_settings(self): from .v2020_11_01_preview.operations import MonitoringSettingsOperations as OperationClass elif api_version == '2021-06-01-preview': from .v2021_06_01_preview.operations import MonitoringSettingsOperations as OperationClass + elif api_version == '2021-09-01-preview': + from .v2021_09_01_preview.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))) @@ -267,6 +289,7 @@ def operations(self): * 2020-07-01: :class:`Operations` * 2020-11-01-preview: :class:`Operations` * 2021-06-01-preview: :class:`Operations` + * 2021-09-01-preview: :class:`Operations` """ api_version = self._get_api_version('operations') if api_version == '2019-05-01-preview': @@ -277,6 +300,8 @@ def operations(self): from .v2020_11_01_preview.operations import Operations as OperationClass elif api_version == '2021-06-01-preview': from .v2021_06_01_preview.operations import Operations as OperationClass + elif api_version == '2021-09-01-preview': + from .v2021_09_01_preview.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))) @@ -289,6 +314,7 @@ def runtime_versions(self): * 2020-07-01: :class:`RuntimeVersionsOperations` * 2020-11-01-preview: :class:`RuntimeVersionsOperations` * 2021-06-01-preview: :class:`RuntimeVersionsOperations` + * 2021-09-01-preview: :class:`RuntimeVersionsOperations` """ api_version = self._get_api_version('runtime_versions') if api_version == '2019-05-01-preview': @@ -299,6 +325,8 @@ def runtime_versions(self): from .v2020_11_01_preview.operations import RuntimeVersionsOperations as OperationClass elif api_version == '2021-06-01-preview': from .v2021_06_01_preview.operations import RuntimeVersionsOperations as OperationClass + elif api_version == '2021-09-01-preview': + from .v2021_09_01_preview.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))) @@ -311,6 +339,7 @@ def services(self): * 2020-07-01: :class:`ServicesOperations` * 2020-11-01-preview: :class:`ServicesOperations` * 2021-06-01-preview: :class:`ServicesOperations` + * 2021-09-01-preview: :class:`ServicesOperations` """ api_version = self._get_api_version('services') if api_version == '2019-05-01-preview': @@ -321,6 +350,8 @@ def services(self): from .v2020_11_01_preview.operations import ServicesOperations as OperationClass elif api_version == '2021-06-01-preview': from .v2021_06_01_preview.operations import ServicesOperations as OperationClass + elif api_version == '2021-09-01-preview': + from .v2021_09_01_preview.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))) @@ -345,6 +376,7 @@ def skus(self): * 2020-07-01: :class:`SkusOperations` * 2020-11-01-preview: :class:`SkusOperations` * 2021-06-01-preview: :class:`SkusOperations` + * 2021-09-01-preview: :class:`SkusOperations` """ api_version = self._get_api_version('skus') if api_version == '2020-07-01': @@ -353,10 +385,25 @@ def skus(self): from .v2020_11_01_preview.operations import SkusOperations as OperationClass elif api_version == '2021-06-01-preview': from .v2021_06_01_preview.operations import SkusOperations as OperationClass + elif api_version == '2021-09-01-preview': + from .v2021_09_01_preview.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))) + @property + def storages(self): + """Instance depends on the API version: + + * 2021-09-01-preview: :class:`StoragesOperations` + """ + api_version = self._get_api_version('storages') + if api_version == '2021-09-01-preview': + from .v2021_09_01_preview.operations import StoragesOperations as OperationClass + else: + raise ValueError("API version {} does not have operation group 'storages'".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): diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/_configuration.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/_configuration.py index 7ab9f3c3d5133..60e24d4ade156 100644 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/_configuration.py +++ b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/_configuration.py @@ -12,7 +12,7 @@ from azure.core.configuration import Configuration from azure.core.pipeline import policies -from azure.mgmt.core.policies import ARMHttpLoggingPolicy +from azure.mgmt.core.policies import ARMChallengeAuthenticationPolicy, ARMHttpLoggingPolicy from ._version import VERSION @@ -68,4 +68,4 @@ def _configure( 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) + self.authentication_policy = ARMChallengeAuthenticationPolicy(self.credential, *self.credential_scopes, **kwargs) diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/aio/_app_platform_management_client.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/aio/_app_platform_management_client.py index 401fdc2946754..db7015b4ea00f 100644 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/aio/_app_platform_management_client.py +++ b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/aio/_app_platform_management_client.py @@ -11,7 +11,6 @@ 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 @@ -21,6 +20,7 @@ if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports + from azure.core.credentials import TokenCredential from azure.core.credentials_async import AsyncTokenCredential class _SDKClient(object): @@ -69,12 +69,10 @@ def __init__( credential: "AsyncTokenCredential", subscription_id: str, api_version: Optional[str] = None, - base_url: Optional[str] = None, + base_url: str = "https://management.azure.com", 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__( @@ -94,6 +92,7 @@ def models(cls, api_version=DEFAULT_API_VERSION): * 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` + * 2021-09-01-preview: :mod:`v2021_09_01_preview.models` """ if api_version == '2019-05-01-preview': from ..v2019_05_01_preview import models @@ -107,6 +106,9 @@ def models(cls, api_version=DEFAULT_API_VERSION): elif api_version == '2021-06-01-preview': from ..v2021_06_01_preview import models return models + elif api_version == '2021-09-01-preview': + from ..v2021_09_01_preview import models + return models raise ValueError("API version {} is not available".format(api_version)) @property @@ -117,6 +119,7 @@ def apps(self): * 2020-07-01: :class:`AppsOperations` * 2020-11-01-preview: :class:`AppsOperations` * 2021-06-01-preview: :class:`AppsOperations` + * 2021-09-01-preview: :class:`AppsOperations` """ api_version = self._get_api_version('apps') if api_version == '2019-05-01-preview': @@ -127,6 +130,8 @@ def apps(self): 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 + elif api_version == '2021-09-01-preview': + from ..v2021_09_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))) @@ -139,6 +144,7 @@ def bindings(self): * 2020-07-01: :class:`BindingsOperations` * 2020-11-01-preview: :class:`BindingsOperations` * 2021-06-01-preview: :class:`BindingsOperations` + * 2021-09-01-preview: :class:`BindingsOperations` """ api_version = self._get_api_version('bindings') if api_version == '2019-05-01-preview': @@ -149,6 +155,8 @@ def bindings(self): 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 + elif api_version == '2021-09-01-preview': + from ..v2021_09_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))) @@ -161,6 +169,7 @@ def certificates(self): * 2020-07-01: :class:`CertificatesOperations` * 2020-11-01-preview: :class:`CertificatesOperations` * 2021-06-01-preview: :class:`CertificatesOperations` + * 2021-09-01-preview: :class:`CertificatesOperations` """ api_version = self._get_api_version('certificates') if api_version == '2019-05-01-preview': @@ -171,6 +180,8 @@ def certificates(self): 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 + elif api_version == '2021-09-01-preview': + from ..v2021_09_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))) @@ -182,6 +193,7 @@ def config_servers(self): * 2020-07-01: :class:`ConfigServersOperations` * 2020-11-01-preview: :class:`ConfigServersOperations` * 2021-06-01-preview: :class:`ConfigServersOperations` + * 2021-09-01-preview: :class:`ConfigServersOperations` """ api_version = self._get_api_version('config_servers') if api_version == '2020-07-01': @@ -190,6 +202,8 @@ def config_servers(self): 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 + elif api_version == '2021-09-01-preview': + from ..v2021_09_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))) @@ -202,6 +216,7 @@ def custom_domains(self): * 2020-07-01: :class:`CustomDomainsOperations` * 2020-11-01-preview: :class:`CustomDomainsOperations` * 2021-06-01-preview: :class:`CustomDomainsOperations` + * 2021-09-01-preview: :class:`CustomDomainsOperations` """ api_version = self._get_api_version('custom_domains') if api_version == '2019-05-01-preview': @@ -212,6 +227,8 @@ def custom_domains(self): 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 + elif api_version == '2021-09-01-preview': + from ..v2021_09_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))) @@ -224,6 +241,7 @@ def deployments(self): * 2020-07-01: :class:`DeploymentsOperations` * 2020-11-01-preview: :class:`DeploymentsOperations` * 2021-06-01-preview: :class:`DeploymentsOperations` + * 2021-09-01-preview: :class:`DeploymentsOperations` """ api_version = self._get_api_version('deployments') if api_version == '2019-05-01-preview': @@ -234,6 +252,8 @@ def deployments(self): 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 + elif api_version == '2021-09-01-preview': + from ..v2021_09_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))) @@ -245,6 +265,7 @@ def monitoring_settings(self): * 2020-07-01: :class:`MonitoringSettingsOperations` * 2020-11-01-preview: :class:`MonitoringSettingsOperations` * 2021-06-01-preview: :class:`MonitoringSettingsOperations` + * 2021-09-01-preview: :class:`MonitoringSettingsOperations` """ api_version = self._get_api_version('monitoring_settings') if api_version == '2020-07-01': @@ -253,6 +274,8 @@ def monitoring_settings(self): 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 + elif api_version == '2021-09-01-preview': + from ..v2021_09_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))) @@ -265,6 +288,7 @@ def operations(self): * 2020-07-01: :class:`Operations` * 2020-11-01-preview: :class:`Operations` * 2021-06-01-preview: :class:`Operations` + * 2021-09-01-preview: :class:`Operations` """ api_version = self._get_api_version('operations') if api_version == '2019-05-01-preview': @@ -275,6 +299,8 @@ def operations(self): 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 + elif api_version == '2021-09-01-preview': + from ..v2021_09_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))) @@ -287,6 +313,7 @@ def runtime_versions(self): * 2020-07-01: :class:`RuntimeVersionsOperations` * 2020-11-01-preview: :class:`RuntimeVersionsOperations` * 2021-06-01-preview: :class:`RuntimeVersionsOperations` + * 2021-09-01-preview: :class:`RuntimeVersionsOperations` """ api_version = self._get_api_version('runtime_versions') if api_version == '2019-05-01-preview': @@ -297,6 +324,8 @@ def runtime_versions(self): 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 + elif api_version == '2021-09-01-preview': + from ..v2021_09_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))) @@ -309,6 +338,7 @@ def services(self): * 2020-07-01: :class:`ServicesOperations` * 2020-11-01-preview: :class:`ServicesOperations` * 2021-06-01-preview: :class:`ServicesOperations` + * 2021-09-01-preview: :class:`ServicesOperations` """ api_version = self._get_api_version('services') if api_version == '2019-05-01-preview': @@ -319,6 +349,8 @@ def services(self): 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 + elif api_version == '2021-09-01-preview': + from ..v2021_09_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))) @@ -343,6 +375,7 @@ def skus(self): * 2020-07-01: :class:`SkusOperations` * 2020-11-01-preview: :class:`SkusOperations` * 2021-06-01-preview: :class:`SkusOperations` + * 2021-09-01-preview: :class:`SkusOperations` """ api_version = self._get_api_version('skus') if api_version == '2020-07-01': @@ -351,10 +384,25 @@ def skus(self): 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 + elif api_version == '2021-09-01-preview': + from ..v2021_09_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))) + @property + def storages(self): + """Instance depends on the API version: + + * 2021-09-01-preview: :class:`StoragesOperations` + """ + api_version = self._get_api_version('storages') + if api_version == '2021-09-01-preview': + from ..v2021_09_01_preview.aio.operations import StoragesOperations as OperationClass + else: + raise ValueError("API version {} does not have operation group 'storages'".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): diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/aio/_configuration.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/aio/_configuration.py index d383d0e075426..10eb9d6f0e9a9 100644 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/aio/_configuration.py +++ b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/aio/_configuration.py @@ -12,7 +12,7 @@ from azure.core.configuration import Configuration from azure.core.pipeline import policies -from azure.mgmt.core.policies import ARMHttpLoggingPolicy +from azure.mgmt.core.policies import ARMHttpLoggingPolicy, AsyncARMChallengeAuthenticationPolicy from .._version import VERSION @@ -64,4 +64,4 @@ def _configure( 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) + self.authentication_policy = AsyncARMChallengeAuthenticationPolicy(self.credential, *self.credential_scopes, **kwargs) diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2019_05_01_preview/__init__.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2019_05_01_preview/__init__.py index d2ddf950056ad..41ec6d71ff7fa 100644 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2019_05_01_preview/__init__.py +++ b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2019_05_01_preview/__init__.py @@ -12,8 +12,7 @@ __version__ = VERSION __all__ = ['AppPlatformManagementClient'] -try: - from ._patch import patch_sdk # type: ignore - patch_sdk() -except ImportError: - pass +# `._patch.py` is used for handwritten extensions to the generated code +# Example: https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md +from ._patch import patch_sdk +patch_sdk() diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2019_05_01_preview/_app_platform_management_client.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2019_05_01_preview/_app_platform_management_client.py index 82ff1e7eeb212..f560c291c5853 100644 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2019_05_01_preview/_app_platform_management_client.py +++ b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2019_05_01_preview/_app_platform_management_client.py @@ -6,30 +6,22 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from copy import deepcopy from typing import TYPE_CHECKING from azure.mgmt.core import ARMPipelineClient from msrest import Deserializer, Serializer +from . import models +from ._configuration import AppPlatformManagementClientConfiguration +from .operations import AppsOperations, BindingsOperations, CertificatesOperations, CustomDomainsOperations, DeploymentsOperations, Operations, RuntimeVersionsOperations, ServicesOperations, SkuOperations + 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 -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 - + from azure.core.rest import HttpRequest, HttpResponse class AppPlatformManagementClient(object): """REST API for Azure Spring Cloud. @@ -41,79 +33,84 @@ class AppPlatformManagementClient(object): :ivar bindings: BindingsOperations operations :vartype bindings: azure.mgmt.appplatform.v2019_05_01_preview.operations.BindingsOperations :ivar certificates: CertificatesOperations operations - :vartype certificates: azure.mgmt.appplatform.v2019_05_01_preview.operations.CertificatesOperations + :vartype certificates: + azure.mgmt.appplatform.v2019_05_01_preview.operations.CertificatesOperations :ivar custom_domains: CustomDomainsOperations operations - :vartype custom_domains: azure.mgmt.appplatform.v2019_05_01_preview.operations.CustomDomainsOperations + :vartype custom_domains: + azure.mgmt.appplatform.v2019_05_01_preview.operations.CustomDomainsOperations :ivar deployments: DeploymentsOperations operations - :vartype deployments: azure.mgmt.appplatform.v2019_05_01_preview.operations.DeploymentsOperations + :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: RuntimeVersionsOperations operations - :vartype runtime_versions: azure.mgmt.appplatform.v2019_05_01_preview.operations.RuntimeVersionsOperations + :vartype runtime_versions: + azure.mgmt.appplatform.v2019_05_01_preview.operations.RuntimeVersionsOperations :ivar sku: SkuOperations operations :vartype sku: azure.mgmt.appplatform.v2019_05_01_preview.operations.SkuOperations :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. + :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. + :param base_url: Service URL. Default value is 'https://management.azure.com'. + :type base_url: str + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. """ def __init__( self, credential, # type: "TokenCredential" subscription_id, # type: str - base_url=None, # type: Optional[str] + base_url="https://management.azure.com", # type: str **kwargs # type: Any ): # type: (...) -> None - if not base_url: - base_url = 'https://management.azure.com' - self._config = AppPlatformManagementClientConfiguration(credential, subscription_id, **kwargs) + self._config = AppPlatformManagementClientConfiguration(credential=credential, subscription_id=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._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) - - def _send_request(self, http_request, **kwargs): - # type: (HttpRequest, Any) -> HttpResponse + self._serialize.client_side_validation = False + 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) + + + def _send_request( + self, + request, # type: HttpRequest + **kwargs # type: Any + ): + # type: (...) -> 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. + >>> from azure.core.rest import HttpRequest + >>> request = HttpRequest("GET", "https://www.example.org/") + + >>> response = client._send_request(request) + + + For more information on this code flow, see https://aka.ms/azsdk/python/protocol/quickstart + + :param request: The network request you want to make. Required. + :type request: ~azure.core.rest.HttpRequest + :keyword bool stream: Whether the response payload will be streamed. Defaults to False. :return: The response of your network call. Does not do error handling on your response. - :rtype: ~azure.core.pipeline.transport.HttpResponse + :rtype: ~azure.core.rest.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 + + request_copy = deepcopy(request) + request_copy.url = self._client.format_url(request_copy.url) + return self._client.send_request(request_copy, **kwargs) def close(self): # type: () -> None diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2019_05_01_preview/_configuration.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2019_05_01_preview/_configuration.py index 18a7e2758d068..81eb23707b492 100644 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2019_05_01_preview/_configuration.py +++ b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2019_05_01_preview/_configuration.py @@ -10,7 +10,7 @@ from azure.core.configuration import Configuration from azure.core.pipeline import policies -from azure.mgmt.core.policies import ARMHttpLoggingPolicy +from azure.mgmt.core.policies import ARMChallengeAuthenticationPolicy, ARMHttpLoggingPolicy from ._version import VERSION @@ -40,11 +40,11 @@ def __init__( **kwargs # type: Any ): # type: (...) -> None + super(AppPlatformManagementClientConfiguration, self).__init__(**kwargs) 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 @@ -68,4 +68,4 @@ def _configure( 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) + self.authentication_policy = ARMChallengeAuthenticationPolicy(self.credential, *self.credential_scopes, **kwargs) diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2019_05_01_preview/_metadata.json b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2019_05_01_preview/_metadata.json index ed50cf259b5ef..99eb2299b3fde 100644 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2019_05_01_preview/_metadata.json +++ b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2019_05_01_preview/_metadata.json @@ -5,13 +5,13 @@ "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, + "host_value": "\"https://management.azure.com\"", + "parameterized_host_template": 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\"]}}}" + "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\"]}}}", + "async_imports": "{\"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"], \"azure.core.credentials\": [\"TokenCredential\"]}}, \"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\"]}}}" }, "global_parameters": { "sync": { @@ -54,7 +54,7 @@ "required": false }, "base_url": { - "signature": "base_url=None, # type: Optional[str]", + "signature": "base_url=\"https://management.azure.com\", # type: str", "description": "Service URL", "docstring_type": "str", "required": false @@ -74,7 +74,7 @@ "required": false }, "base_url": { - "signature": "base_url: Optional[str] = None,", + "signature": "base_url: str = \"https://management.azure.com\",", "description": "Service URL", "docstring_type": "str", "required": false @@ -91,11 +91,10 @@ "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\"]}}}" + "credential_call_sync": "ARMChallengeAuthenticationPolicy(self.credential, *self.credential_scopes, **kwargs)", + "credential_call_async": "AsyncARMChallengeAuthenticationPolicy(self.credential, *self.credential_scopes, **kwargs)", + "sync_imports": "{\"regular\": {\"azurecore\": {\"azure.core.configuration\": [\"Configuration\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMChallengeAuthenticationPolicy\", \"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\", \"AsyncARMChallengeAuthenticationPolicy\"]}, \"local\": {\".._version\": [\"VERSION\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\"]}}, \"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}}" }, "operation_groups": { "services": "ServicesOperations", diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2019_05_01_preview/_patch.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2019_05_01_preview/_patch.py new file mode 100644 index 0000000000000..74e48ecd07cf3 --- /dev/null +++ b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2019_05_01_preview/_patch.py @@ -0,0 +1,31 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# +# Copyright (c) Microsoft Corporation. All rights reserved. +# +# The MIT License (MIT) +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the ""Software""), to +# deal in the Software without restriction, including without limitation the +# rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +# sell copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in +# all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED *AS IS*, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +# IN THE SOFTWARE. +# +# -------------------------------------------------------------------------- + +# This file is used for handwritten extensions to the generated code. Example: +# https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md +def patch_sdk(): + pass \ No newline at end of file diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2019_05_01_preview/_vendor.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2019_05_01_preview/_vendor.py new file mode 100644 index 0000000000000..138f663c53a4e --- /dev/null +++ b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2019_05_01_preview/_vendor.py @@ -0,0 +1,27 @@ +# -------------------------------------------------------------------------- +# 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 azure.core.pipeline.transport import HttpRequest + +def _convert_request(request, files=None): + data = request.content if not files else None + request = HttpRequest(method=request.method, url=request.url, headers=request.headers, data=data) + if files: + request.set_formdata_body(files) + return request + +def _format_url_section(template, **kwargs): + components = template.split("/") + while components: + try: + return template.format(**kwargs) + except KeyError as key: + formatted_components = template.split("/") + components = [ + c for c in formatted_components if "{}".format(key.args[0]) not in c + ] + template = "/".join(components) diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2019_05_01_preview/_version.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2019_05_01_preview/_version.py index 92453d8691d96..e5754a47ce68f 100644 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2019_05_01_preview/_version.py +++ b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2019_05_01_preview/_version.py @@ -6,4 +6,4 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "6.1.0" +VERSION = "1.0.0b1" diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2019_05_01_preview/aio/__init__.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2019_05_01_preview/aio/__init__.py index 39f1054887358..44ce4a5043f80 100644 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2019_05_01_preview/aio/__init__.py +++ b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2019_05_01_preview/aio/__init__.py @@ -8,3 +8,8 @@ from ._app_platform_management_client import AppPlatformManagementClient __all__ = ['AppPlatformManagementClient'] + +# `._patch.py` is used for handwritten extensions to the generated code +# Example: https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md +from ._patch import patch_sdk +patch_sdk() diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2019_05_01_preview/aio/_app_platform_management_client.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2019_05_01_preview/aio/_app_platform_management_client.py index c4e9e2ac7f59e..712c3e84a1b1a 100644 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2019_05_01_preview/aio/_app_platform_management_client.py +++ b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2019_05_01_preview/aio/_app_platform_management_client.py @@ -6,30 +6,22 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, Optional, TYPE_CHECKING +from copy import deepcopy +from typing import Any, Awaitable, Optional, TYPE_CHECKING -from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.mgmt.core import AsyncARMPipelineClient from msrest import Deserializer, Serializer +from .. import models +from ._configuration import AppPlatformManagementClientConfiguration +from .operations import AppsOperations, BindingsOperations, CertificatesOperations, CustomDomainsOperations, DeploymentsOperations, Operations, RuntimeVersionsOperations, ServicesOperations, SkuOperations + 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): +class AppPlatformManagementClient: """REST API for Azure Spring Cloud. :ivar services: ServicesOperations operations @@ -39,77 +31,82 @@ class AppPlatformManagementClient(object): :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 + :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 + :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 + :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 + :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. + :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. + :param base_url: Service URL. Default value is 'https://management.azure.com'. + :type base_url: str + :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, + base_url: str = "https://management.azure.com", **kwargs: Any ) -> None: - if not base_url: - base_url = 'https://management.azure.com' - self._config = AppPlatformManagementClientConfiguration(credential, subscription_id, **kwargs) + self._config = AppPlatformManagementClientConfiguration(credential=credential, subscription_id=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._serialize.client_side_validation = False + 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) + - 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: + def _send_request( + self, + request: HttpRequest, + **kwargs: Any + ) -> Awaitable[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. + >>> from azure.core.rest import HttpRequest + >>> request = HttpRequest("GET", "https://www.example.org/") + + >>> response = await client._send_request(request) + + + For more information on this code flow, see https://aka.ms/azsdk/python/protocol/quickstart + + :param request: The network request you want to make. Required. + :type request: ~azure.core.rest.HttpRequest + :keyword bool stream: Whether the response payload will be streamed. Defaults to False. :return: The response of your network call. Does not do error handling on your response. - :rtype: ~azure.core.pipeline.transport.AsyncHttpResponse + :rtype: ~azure.core.rest.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 + + request_copy = deepcopy(request) + request_copy.url = self._client.format_url(request_copy.url) + return self._client.send_request(request_copy, **kwargs) async def close(self) -> None: await self._client.close() diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2019_05_01_preview/aio/_configuration.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2019_05_01_preview/aio/_configuration.py index a5e13e26a0811..cb170386c7610 100644 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2019_05_01_preview/aio/_configuration.py +++ b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2019_05_01_preview/aio/_configuration.py @@ -10,7 +10,7 @@ from azure.core.configuration import Configuration from azure.core.pipeline import policies -from azure.mgmt.core.policies import ARMHttpLoggingPolicy +from azure.mgmt.core.policies import ARMHttpLoggingPolicy, AsyncARMChallengeAuthenticationPolicy from .._version import VERSION @@ -37,11 +37,11 @@ def __init__( subscription_id: str, **kwargs: Any ) -> None: + super(AppPlatformManagementClientConfiguration, self).__init__(**kwargs) 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 @@ -64,4 +64,4 @@ def _configure( 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) + self.authentication_policy = AsyncARMChallengeAuthenticationPolicy(self.credential, *self.credential_scopes, **kwargs) diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2019_05_01_preview/aio/_patch.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2019_05_01_preview/aio/_patch.py new file mode 100644 index 0000000000000..74e48ecd07cf3 --- /dev/null +++ b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2019_05_01_preview/aio/_patch.py @@ -0,0 +1,31 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# +# Copyright (c) Microsoft Corporation. All rights reserved. +# +# The MIT License (MIT) +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the ""Software""), to +# deal in the Software without restriction, including without limitation the +# rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +# sell copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in +# all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED *AS IS*, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +# IN THE SOFTWARE. +# +# -------------------------------------------------------------------------- + +# This file is used for handwritten extensions to the generated code. Example: +# https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md +def patch_sdk(): + pass \ No newline at end of file diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2019_05_01_preview/aio/operations/_apps_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2019_05_01_preview/aio/operations/_apps_operations.py index 14016781710c2..2241d8383d6db 100644 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2019_05_01_preview/aio/operations/_apps_operations.py +++ b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2019_05_01_preview/aio/operations/_apps_operations.py @@ -5,19 +5,24 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools 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.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._apps_operations import build_create_or_update_request_initial, build_delete_request, build_get_request, build_get_resource_upload_url_request, build_list_request, build_update_request_initial T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -43,6 +48,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace_async async def get( self, resource_group_name: str, @@ -72,30 +78,19 @@ async def get( 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 = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + sync_status=sync_status, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -109,8 +104,10 @@ async def get( 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, @@ -124,33 +121,23 @@ async def _create_or_update_initial( 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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(app_resource, 'AppResource') - # 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') + request = build_create_or_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -168,8 +155,11 @@ async def _create_or_update_initial( 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 + + @distributed_trace_async async def begin_create_or_update( self, resource_group_name: str, @@ -191,15 +181,20 @@ async def begin_create_or_update( :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. + :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: + :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] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.AppResource"] lro_delay = kwargs.pop( 'polling_interval', @@ -212,28 +207,21 @@ async def begin_create_or_update( service_name=service_name, app_name=app_name, app_resource=app_resource, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_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) + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -245,8 +233,10 @@ def get_long_running_output(pipeline_response): ) 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 + @distributed_trace_async async def delete( self, resource_group_name: str, @@ -273,28 +263,18 @@ async def delete( 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 = build_delete_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + template_url=self.delete.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -307,6 +287,7 @@ async def delete( 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, @@ -320,33 +301,23 @@ async def _update_initial( 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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(app_resource, 'AppResource') - # 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') + request = build_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + content_type=content_type, + json=_json, + template_url=self._update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -364,8 +335,11 @@ async def _update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}'} # type: ignore + + @distributed_trace_async async def begin_update( self, resource_group_name: str, @@ -387,15 +361,20 @@ async def begin_update( :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. + :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: + :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] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.AppResource"] lro_delay = kwargs.pop( 'polling_interval', @@ -408,28 +387,21 @@ async def begin_update( service_name=service_name, app_name=app_name, app_resource=app_resource, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_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) + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -441,8 +413,10 @@ def get_long_running_output(pipeline_response): ) 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 + @distributed_trace def list( self, resource_group_name: str, @@ -457,8 +431,10 @@ def list( :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] + :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"] @@ -466,36 +442,33 @@ def list( 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) + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('AppResourceCollection', pipeline_response) + deserialized = self._deserialize("AppResourceCollection", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -513,11 +486,13 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps'} # type: ignore + @distributed_trace_async async def get_resource_upload_url( self, resource_group_name: str, @@ -544,28 +519,18 @@ async def get_resource_upload_url( 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 = build_get_resource_upload_url_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + template_url=self.get_resource_upload_url.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -579,4 +544,6 @@ async def get_resource_upload_url( 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/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2019_05_01_preview/aio/operations/_bindings_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2019_05_01_preview/aio/operations/_bindings_operations.py index 713c34adbbd48..b7f7eb200137c 100644 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2019_05_01_preview/aio/operations/_bindings_operations.py +++ b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2019_05_01_preview/aio/operations/_bindings_operations.py @@ -5,17 +5,22 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools 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.core.pipeline.transport import AsyncHttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._bindings_operations import build_create_or_update_request, build_delete_request, build_get_request, build_list_request, build_update_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -41,6 +46,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace_async async def get( self, resource_group_name: str, @@ -70,29 +76,19 @@ async def get( 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 = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + binding_name=binding_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -106,8 +102,11 @@ async def get( 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 + + @distributed_trace_async async def create_or_update( self, resource_group_name: str, @@ -140,34 +139,24 @@ async def create_or_update( 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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(binding_resource, 'BindingResource') - # 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') + request = build_create_or_update_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + binding_name=binding_name, + content_type=content_type, + json=_json, + template_url=self.create_or_update.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -181,8 +170,11 @@ async def create_or_update( 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 + + @distributed_trace_async async def delete( self, resource_group_name: str, @@ -212,29 +204,19 @@ async def delete( 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 = build_delete_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + binding_name=binding_name, + template_url=self.delete.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -247,6 +229,8 @@ async def delete( delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/bindings/{bindingName}'} # type: ignore + + @distributed_trace_async async def update( self, resource_group_name: str, @@ -279,34 +263,24 @@ async def update( 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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(binding_resource, 'BindingResource') - # 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') + request = build_update_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + binding_name=binding_name, + content_type=content_type, + json=_json, + template_url=self.update.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -320,8 +294,11 @@ async def update( 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 + + @distributed_trace def list( self, resource_group_name: str, @@ -339,8 +316,10 @@ def list( :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] + :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"] @@ -348,37 +327,35 @@ def list( 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) + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('BindingResourceCollection', pipeline_response) + deserialized = self._deserialize("BindingResourceCollection", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -396,6 +373,7 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2019_05_01_preview/aio/operations/_certificates_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2019_05_01_preview/aio/operations/_certificates_operations.py index b8b4fd4147231..e6e9511487da8 100644 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2019_05_01_preview/aio/operations/_certificates_operations.py +++ b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2019_05_01_preview/aio/operations/_certificates_operations.py @@ -5,17 +5,22 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools 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.core.pipeline.transport import AsyncHttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._certificates_operations import build_create_or_update_request, build_delete_request, build_get_request, build_list_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -41,6 +46,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace_async async def get( self, resource_group_name: str, @@ -67,28 +73,18 @@ async def get( 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 = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + certificate_name=certificate_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -102,8 +98,11 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/certificates/{certificateName}'} # type: ignore + + @distributed_trace_async async def create_or_update( self, resource_group_name: str, @@ -122,7 +121,8 @@ async def create_or_update( :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 + :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 @@ -133,33 +133,23 @@ async def create_or_update( 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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = self._serialize.body(certificate_resource, 'CertificateResource') + + request = build_create_or_update_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + certificate_name=certificate_name, + content_type=content_type, + json=_json, + template_url=self.create_or_update.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -173,8 +163,11 @@ async def create_or_update( 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 + + @distributed_trace_async async def delete( self, resource_group_name: str, @@ -201,28 +194,18 @@ async def delete( 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 = build_delete_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + certificate_name=certificate_name, + template_url=self.delete.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -235,6 +218,8 @@ async def delete( delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/certificates/{certificateName}'} # type: ignore + + @distributed_trace def list( self, resource_group_name: str, @@ -249,8 +234,10 @@ def list( :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] + :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"] @@ -258,36 +245,33 @@ def list( 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) + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('CertificateResourceCollection', pipeline_response) + deserialized = self._deserialize("CertificateResourceCollection", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -305,6 +289,7 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2019_05_01_preview/aio/operations/_custom_domains_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2019_05_01_preview/aio/operations/_custom_domains_operations.py index 34096d1ba4d11..b29d4a30da369 100644 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2019_05_01_preview/aio/operations/_custom_domains_operations.py +++ b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2019_05_01_preview/aio/operations/_custom_domains_operations.py @@ -5,17 +5,22 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools 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.core.pipeline.transport import AsyncHttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._custom_domains_operations import build_create_or_update_request, build_delete_request, build_get_request, build_list_request, build_patch_request, build_validate_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -41,6 +46,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace_async async def get( self, resource_group_name: str, @@ -70,29 +76,19 @@ async def get( 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 = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + domain_name=domain_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -106,8 +102,11 @@ async def get( 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 + + @distributed_trace_async async def create_or_update( self, resource_group_name: str, @@ -140,34 +139,24 @@ async def create_or_update( 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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = self._serialize.body(domain_resource, 'CustomDomainResource') + + request = build_create_or_update_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + domain_name=domain_name, + content_type=content_type, + json=_json, + template_url=self.create_or_update.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -181,8 +170,11 @@ async def create_or_update( 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 + + @distributed_trace_async async def delete( self, resource_group_name: str, @@ -212,29 +204,19 @@ async def delete( 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 = build_delete_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + domain_name=domain_name, + template_url=self.delete.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -247,6 +229,8 @@ async def delete( delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/domains/{domainName}'} # type: ignore + + @distributed_trace_async async def patch( self, resource_group_name: str, @@ -279,34 +263,24 @@ async def patch( 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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(domain_resource, 'CustomDomainResource') - # 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') + request = build_patch_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + domain_name=domain_name, + content_type=content_type, + json=_json, + template_url=self.patch.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -320,8 +294,11 @@ async def patch( 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 + + @distributed_trace def list( self, resource_group_name: str, @@ -339,8 +316,10 @@ def list( :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] + :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"] @@ -348,37 +327,35 @@ def list( 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) + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('CustomDomainResourceCollection', pipeline_response) + deserialized = self._deserialize("CustomDomainResourceCollection", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -396,11 +373,13 @@ async def get_next(next_link=None): 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 + @distributed_trace_async async def validate( self, resource_group_name: str, @@ -419,7 +398,8 @@ async def validate( :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 + :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 @@ -430,33 +410,23 @@ async def validate( 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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = self._serialize.body(validate_payload, 'CustomDomainValidatePayload') + + request = build_validate_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + content_type=content_type, + json=_json, + template_url=self.validate.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -470,4 +440,6 @@ async def validate( 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/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2019_05_01_preview/aio/operations/_deployments_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2019_05_01_preview/aio/operations/_deployments_operations.py index a4d1214cce225..50e49cf08d645 100644 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2019_05_01_preview/aio/operations/_deployments_operations.py +++ b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2019_05_01_preview/aio/operations/_deployments_operations.py @@ -5,19 +5,24 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools 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.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._deployments_operations import build_create_or_update_request_initial, build_delete_request, build_get_log_file_url_request, build_get_request, build_list_cluster_all_deployments_request, build_list_request, build_restart_request_initial, build_start_request_initial, build_stop_request_initial, build_update_request_initial T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -43,6 +48,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace_async async def get( self, resource_group_name: str, @@ -72,29 +78,19 @@ async def get( 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 = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + deployment_name=deployment_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -108,8 +104,10 @@ async def get( 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, @@ -124,34 +122,24 @@ async def _create_or_update_initial( 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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = self._serialize.body(deployment_resource, 'DeploymentResource') + + request = build_create_or_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + deployment_name=deployment_name, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -172,8 +160,11 @@ async def _create_or_update_initial( 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 + + @distributed_trace_async async def begin_create_or_update( self, resource_group_name: str, @@ -195,18 +186,24 @@ async def begin_create_or_update( :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 + :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. + :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: + :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] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.DeploymentResource"] lro_delay = kwargs.pop( 'polling_interval', @@ -220,29 +217,21 @@ async def begin_create_or_update( app_name=app_name, deployment_name=deployment_name, deployment_resource=deployment_resource, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_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) + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -254,8 +243,10 @@ def get_long_running_output(pipeline_response): ) 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 + @distributed_trace_async async def delete( self, resource_group_name: str, @@ -285,29 +276,19 @@ async def delete( 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 = build_delete_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + deployment_name=deployment_name, + template_url=self.delete.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -320,6 +301,7 @@ async def delete( 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, @@ -334,34 +316,24 @@ async def _update_initial( 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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = self._serialize.body(deployment_resource, 'DeploymentResource') + + request = build_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + deployment_name=deployment_name, + content_type=content_type, + json=_json, + template_url=self._update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -379,8 +351,11 @@ async def _update_initial( 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 + + @distributed_trace_async async def begin_update( self, resource_group_name: str, @@ -402,18 +377,24 @@ async def begin_update( :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 + :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. + :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: + :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] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.DeploymentResource"] lro_delay = kwargs.pop( 'polling_interval', @@ -427,29 +408,21 @@ async def begin_update( app_name=app_name, deployment_name=deployment_name, deployment_resource=deployment_resource, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_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) + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -461,8 +434,10 @@ def get_long_running_output(pipeline_response): ) 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 + @distributed_trace def list( self, resource_group_name: str, @@ -483,8 +458,10 @@ def list( :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] + :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"] @@ -492,39 +469,37 @@ def list( 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) + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + version=version, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + version=version, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('DeploymentResourceCollection', pipeline_response) + deserialized = self._deserialize("DeploymentResourceCollection", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -542,11 +517,13 @@ async def get_next(next_link=None): 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 + @distributed_trace def list_cluster_all_deployments( self, resource_group_name: str, @@ -564,8 +541,10 @@ def list_cluster_all_deployments( :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] + :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"] @@ -573,38 +552,35 @@ def list_cluster_all_deployments( 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) + + request = build_list_cluster_all_deployments_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + version=version, + template_url=self.list_cluster_all_deployments.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_cluster_all_deployments_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + version=version, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('DeploymentResourceCollection', pipeline_response) + deserialized = self._deserialize("DeploymentResourceCollection", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -622,6 +598,7 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) @@ -640,29 +617,19 @@ async def _start_initial( 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 = build_start_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + deployment_name=deployment_name, + template_url=self._start_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -675,6 +642,8 @@ async def _start_initial( _start_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/start'} # type: ignore + + @distributed_trace_async async def begin_start( self, resource_group_name: str, @@ -696,15 +665,17 @@ async def begin_start( :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. + :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. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -720,23 +691,14 @@ async def begin_start( 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) + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -748,6 +710,7 @@ def get_long_running_output(pipeline_response): ) 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( @@ -763,29 +726,19 @@ async def _stop_initial( 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 = build_stop_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + deployment_name=deployment_name, + template_url=self._stop_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -798,6 +751,8 @@ async def _stop_initial( _stop_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/stop'} # type: ignore + + @distributed_trace_async async def begin_stop( self, resource_group_name: str, @@ -819,15 +774,17 @@ async def begin_stop( :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. + :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. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -843,23 +800,14 @@ async def begin_stop( 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) + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -871,6 +819,7 @@ def get_long_running_output(pipeline_response): ) 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( @@ -886,29 +835,19 @@ async def _restart_initial( 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 = build_restart_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + deployment_name=deployment_name, + template_url=self._restart_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -921,6 +860,8 @@ async def _restart_initial( _restart_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/restart'} # type: ignore + + @distributed_trace_async async def begin_restart( self, resource_group_name: str, @@ -942,15 +883,17 @@ async def begin_restart( :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. + :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. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -966,23 +909,14 @@ async def begin_restart( 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) + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -994,8 +928,10 @@ def get_long_running_output(pipeline_response): ) 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 + @distributed_trace_async async def get_log_file_url( self, resource_group_name: str, @@ -1025,29 +961,19 @@ async def get_log_file_url( 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 = build_get_log_file_url_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + deployment_name=deployment_name, + template_url=self.get_log_file_url.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -1063,4 +989,6 @@ async def get_log_file_url( 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/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2019_05_01_preview/aio/operations/_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2019_05_01_preview/aio/operations/_operations.py index 8f6523f5508d7..5be8a0aac00be 100644 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2019_05_01_preview/aio/operations/_operations.py +++ b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2019_05_01_preview/aio/operations/_operations.py @@ -5,17 +5,22 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools 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.core.pipeline.transport import AsyncHttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._operations import build_list_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -41,6 +46,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace def list( self, **kwargs: Any @@ -49,7 +55,8 @@ def list( :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] + :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"] @@ -57,30 +64,27 @@ def list( 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 = build_list_request( + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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) + + request = build_list_request( + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('AvailableOperations', pipeline_response) + deserialized = self._deserialize("AvailableOperations", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -98,6 +102,7 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2019_05_01_preview/aio/operations/_runtime_versions_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2019_05_01_preview/aio/operations/_runtime_versions_operations.py index 9d18f8356140f..55d8fc9d50469 100644 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2019_05_01_preview/aio/operations/_runtime_versions_operations.py +++ b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2019_05_01_preview/aio/operations/_runtime_versions_operations.py @@ -5,16 +5,20 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools 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.core.pipeline.transport import AsyncHttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._runtime_versions_operations import build_list_runtime_versions_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -40,6 +44,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace_async async def list_runtime_versions( self, **kwargs: Any @@ -56,21 +61,14 @@ async def list_runtime_versions( 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 = build_list_runtime_versions_request( + template_url=self.list_runtime_versions.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -84,4 +82,6 @@ async def list_runtime_versions( return cls(pipeline_response, deserialized, {}) return deserialized + list_runtime_versions.metadata = {'url': '/providers/Microsoft.AppPlatform/runtimeVersions'} # type: ignore + diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2019_05_01_preview/aio/operations/_services_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2019_05_01_preview/aio/operations/_services_operations.py index dc2d775104919..0748b54f38592 100644 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2019_05_01_preview/aio/operations/_services_operations.py +++ b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2019_05_01_preview/aio/operations/_services_operations.py @@ -5,19 +5,24 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools 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.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._services_operations import build_check_name_availability_request, build_create_or_update_request_initial, build_delete_request_initial, build_disable_test_endpoint_request, build_enable_test_endpoint_request, build_get_request, build_list_by_subscription_request, build_list_request, build_list_test_keys_request, build_regenerate_test_key_request, build_update_request_initial T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -43,6 +48,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace_async async def get( self, resource_group_name: str, @@ -66,27 +72,17 @@ async def get( 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 = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -100,8 +96,10 @@ async def get( 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, @@ -114,32 +112,22 @@ async def _create_or_update_initial( 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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = self._serialize.body(resource, 'ServiceResource') + + request = build_create_or_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -157,8 +145,11 @@ async def _create_or_update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}'} # type: ignore + + @distributed_trace_async async def begin_create_or_update( self, resource_group_name: str, @@ -177,15 +168,20 @@ async def begin_create_or_update( :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. + :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: + :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] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.ServiceResource"] lro_delay = kwargs.pop( 'polling_interval', @@ -197,27 +193,21 @@ async def begin_create_or_update( resource_group_name=resource_group_name, service_name=service_name, resource=resource, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_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) + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -229,6 +219,7 @@ def get_long_running_output(pipeline_response): ) 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( @@ -242,27 +233,17 @@ async def _delete_initial( 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 = build_delete_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -275,6 +256,8 @@ async def _delete_initial( _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}'} # type: ignore + + @distributed_trace_async async def begin_delete( self, resource_group_name: str, @@ -290,15 +273,17 @@ async def begin_delete( :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. + :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. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -312,21 +297,14 @@ async def begin_delete( 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) + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -338,6 +316,7 @@ def get_long_running_output(pipeline_response): ) 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( @@ -352,32 +331,22 @@ async def _update_initial( 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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = self._serialize.body(resource, 'ServiceResource') + + request = build_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + content_type=content_type, + json=_json, + template_url=self._update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -395,8 +364,11 @@ async def _update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}'} # type: ignore + + @distributed_trace_async async def begin_update( self, resource_group_name: str, @@ -415,15 +387,20 @@ async def begin_update( :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. + :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: + :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] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.ServiceResource"] lro_delay = kwargs.pop( 'polling_interval', @@ -435,27 +412,21 @@ async def begin_update( resource_group_name=resource_group_name, service_name=service_name, resource=resource, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_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) + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -467,8 +438,10 @@ def get_long_running_output(pipeline_response): ) 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 + @distributed_trace_async async def list_test_keys( self, resource_group_name: str, @@ -492,27 +465,17 @@ async def list_test_keys( 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 = build_list_test_keys_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + template_url=self.list_test_keys.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -526,8 +489,11 @@ async def list_test_keys( return cls(pipeline_response, deserialized, {}) return deserialized + list_test_keys.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/listTestKeys'} # type: ignore + + @distributed_trace_async async def regenerate_test_key( self, resource_group_name: str, @@ -543,7 +509,8 @@ async def regenerate_test_key( :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 + :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 @@ -554,32 +521,22 @@ async def regenerate_test_key( 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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = self._serialize.body(regenerate_test_key_request, 'RegenerateTestKeyRequestPayload') + + request = build_regenerate_test_key_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + content_type=content_type, + json=_json, + template_url=self.regenerate_test_key.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -593,8 +550,11 @@ async def regenerate_test_key( return cls(pipeline_response, deserialized, {}) return deserialized + regenerate_test_key.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/regenerateTestKey'} # type: ignore + + @distributed_trace_async async def disable_test_endpoint( self, resource_group_name: str, @@ -618,27 +578,17 @@ async def disable_test_endpoint( 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 = build_disable_test_endpoint_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + template_url=self.disable_test_endpoint.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -651,6 +601,8 @@ async def disable_test_endpoint( disable_test_endpoint.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/disableTestEndpoint'} # type: ignore + + @distributed_trace_async async def enable_test_endpoint( self, resource_group_name: str, @@ -674,27 +626,17 @@ async def enable_test_endpoint( 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 = build_enable_test_endpoint_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + template_url=self.enable_test_endpoint.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -708,8 +650,11 @@ async def enable_test_endpoint( return cls(pipeline_response, deserialized, {}) return deserialized + enable_test_endpoint.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/enableTestEndpoint'} # type: ignore + + @distributed_trace_async async def check_name_availability( self, location: str, @@ -721,7 +666,8 @@ async def check_name_availability( :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 + :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 @@ -732,31 +678,21 @@ async def check_name_availability( 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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = self._serialize.body(availability_parameters, 'NameAvailabilityParameters') + + request = build_check_name_availability_request( + subscription_id=self._config.subscription_id, + location=location, + content_type=content_type, + json=_json, + template_url=self.check_name_availability.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -770,8 +706,11 @@ async def check_name_availability( return cls(pipeline_response, deserialized, {}) return deserialized + check_name_availability.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.AppPlatform/locations/{location}/checkNameAvailability'} # type: ignore + + @distributed_trace def list_by_subscription( self, **kwargs: Any @@ -780,7 +719,8 @@ def list_by_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] + :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"] @@ -788,34 +728,29 @@ def list_by_subscription( 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) + + request = build_list_by_subscription_request( + subscription_id=self._config.subscription_id, + template_url=self.list_by_subscription.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_subscription_request( + subscription_id=self._config.subscription_id, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('ServiceResourceList', pipeline_response) + deserialized = self._deserialize("ServiceResourceList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -833,11 +768,13 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) list_by_subscription.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.AppPlatform/Spring'} # type: ignore + @distributed_trace def list( self, resource_group_name: str, @@ -850,7 +787,8 @@ def list( :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] + :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"] @@ -858,35 +796,31 @@ def list( 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) + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('ServiceResourceList', pipeline_response) + deserialized = self._deserialize("ServiceResourceList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -904,6 +838,7 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2019_05_01_preview/aio/operations/_sku_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2019_05_01_preview/aio/operations/_sku_operations.py index a7111308ab8f7..df141269a8141 100644 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2019_05_01_preview/aio/operations/_sku_operations.py +++ b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2019_05_01_preview/aio/operations/_sku_operations.py @@ -5,17 +5,22 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools 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.core.pipeline.transport import AsyncHttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._sku_operations import build_list_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -41,6 +46,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace def list( self, **kwargs: Any @@ -48,8 +54,10 @@ def list( """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] + :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"] @@ -57,34 +65,29 @@ def list( 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) + + request = build_list_request( + subscription_id=self._config.subscription_id, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('ResourceSkuCollection', pipeline_response) + deserialized = self._deserialize("ResourceSkuCollection", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -102,6 +105,7 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2019_05_01_preview/models/__init__.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2019_05_01_preview/models/__init__.py index ca288c598cf92..d037b80f2efb1 100644 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2019_05_01_preview/models/__init__.py +++ b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2019_05_01_preview/models/__init__.py @@ -138,6 +138,7 @@ from ._models import UserSourceInfo # type: ignore from ._app_platform_management_client_enums import ( + ActionType, AppResourceProvisioningState, ConfigServerState, DeploymentResourceProvisioningState, @@ -221,6 +222,7 @@ 'TraceProperties', 'TrackedResource', 'UserSourceInfo', + 'ActionType', 'AppResourceProvisioningState', 'ConfigServerState', 'DeploymentResourceProvisioningState', diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2019_05_01_preview/models/_app_platform_management_client_enums.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2019_05_01_preview/models/_app_platform_management_client_enums.py index 21a74a5c953c3..e351bdb7c3384 100644 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2019_05_01_preview/models/_app_platform_management_client_enums.py +++ b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2019_05_01_preview/models/_app_platform_management_client_enums.py @@ -6,27 +6,18 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from enum import Enum, EnumMeta +from enum import Enum from six import with_metaclass +from azure.core import CaseInsensitiveEnumMeta -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 ActionType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): + """Enum. Indicates the action type. "Internal" refers to actions that are for internal only APIs. + """ + INTERNAL = "Internal" -class AppResourceProvisioningState(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class AppResourceProvisioningState(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Provisioning state of the App """ @@ -36,7 +27,7 @@ class AppResourceProvisioningState(with_metaclass(_CaseInsensitiveEnumMeta, str, UPDATING = "Updating" DELETING = "Deleting" -class ConfigServerState(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class ConfigServerState(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """State of the config server. """ @@ -46,7 +37,7 @@ class ConfigServerState(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): SUCCEEDED = "Succeeded" UPDATING = "Updating" -class DeploymentResourceProvisioningState(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class DeploymentResourceProvisioningState(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Provisioning state of the Deployment """ @@ -56,7 +47,7 @@ class DeploymentResourceProvisioningState(with_metaclass(_CaseInsensitiveEnumMet FAILED = "Failed" DELETING = "Deleting" -class DeploymentResourceStatus(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class DeploymentResourceStatus(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Status of the Deployment """ @@ -68,14 +59,14 @@ class DeploymentResourceStatus(with_metaclass(_CaseInsensitiveEnumMeta, str, Enu UPGRADING = "Upgrading" COMPILING = "Compiling" -class ManagedIdentityType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +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)): +class ProvisioningState(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Provisioning state of the Service """ @@ -89,7 +80,7 @@ class ProvisioningState(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): MOVED = "Moved" MOVE_FAILED = "MoveFailed" -class ResourceSkuRestrictionsReasonCode(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class ResourceSkuRestrictionsReasonCode(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Gets the reason for restriction. Possible values include: 'QuotaId', 'NotAvailableForSubscription' """ @@ -97,14 +88,14 @@ class ResourceSkuRestrictionsReasonCode(with_metaclass(_CaseInsensitiveEnumMeta, QUOTA_ID = "QuotaId" NOT_AVAILABLE_FOR_SUBSCRIPTION = "NotAvailableForSubscription" -class ResourceSkuRestrictionsType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +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)): +class RuntimeVersion(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Runtime version """ @@ -112,7 +103,7 @@ class RuntimeVersion(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): JAVA11 = "Java_11" NET_CORE31 = "NetCore_31" -class SkuScaleType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class SkuScaleType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Gets or sets the type of the scale. """ @@ -120,14 +111,14 @@ class SkuScaleType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): MANUAL = "Manual" AUTOMATIC = "Automatic" -class SupportedRuntimePlatform(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +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)): +class SupportedRuntimeValue(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The raw value which could be passed to deployment CRUD operations. """ @@ -135,14 +126,14 @@ class SupportedRuntimeValue(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)) JAVA11 = "Java_11" NET_CORE31 = "NetCore_31" -class TestKeyType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class TestKeyType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Type of the test key """ PRIMARY = "Primary" SECONDARY = "Secondary" -class TraceProxyState(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class TraceProxyState(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """State of the trace proxy. """ @@ -151,14 +142,14 @@ class TraceProxyState(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): SUCCEEDED = "Succeeded" UPDATING = "Updating" -class TrafficDirection(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class TrafficDirection(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The direction of required traffic """ INBOUND = "Inbound" OUTBOUND = "Outbound" -class UserSourceType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class UserSourceType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Type of the source uploaded """ diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2019_05_01_preview/models/_models.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2019_05_01_preview/models/_models.py index 8e0cc5fe573b1..9d3fb81b088c9 100644 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2019_05_01_preview/models/_models.py +++ b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2019_05_01_preview/models/_models.py @@ -38,6 +38,8 @@ def __init__( self, **kwargs ): + """ + """ super(Resource, self).__init__(**kwargs) self.id = None self.name = None @@ -73,6 +75,8 @@ def __init__( self, **kwargs ): + """ + """ super(ProxyResource, self).__init__(**kwargs) @@ -87,12 +91,12 @@ 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. - :type location: str + :ivar properties: Properties of the App resource. + :vartype properties: ~azure.mgmt.appplatform.v2019_05_01_preview.models.AppResourceProperties + :ivar identity: The Managed Identity type of the app resource. + :vartype identity: ~azure.mgmt.appplatform.v2019_05_01_preview.models.ManagedIdentityProperties + :ivar location: The GEO location of the application, always the same with its parent resource. + :vartype location: str """ _validation = { @@ -114,6 +118,16 @@ def __init__( self, **kwargs ): + """ + :keyword properties: Properties of the App resource. + :paramtype properties: ~azure.mgmt.appplatform.v2019_05_01_preview.models.AppResourceProperties + :keyword identity: The Managed Identity type of the app resource. + :paramtype identity: + ~azure.mgmt.appplatform.v2019_05_01_preview.models.ManagedIdentityProperties + :keyword location: The GEO location of the application, always the same with its parent + resource. + :paramtype location: str + """ super(AppResource, self).__init__(**kwargs) self.properties = kwargs.get('properties', None) self.identity = kwargs.get('identity', None) @@ -123,11 +137,11 @@ def __init__( 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). + :ivar value: Collection of App resources. + :vartype value: list[~azure.mgmt.appplatform.v2019_05_01_preview.models.AppResource] + :ivar 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 + :vartype next_link: str """ _attribute_map = { @@ -139,6 +153,13 @@ def __init__( self, **kwargs ): + """ + :keyword value: Collection of App resources. + :paramtype value: list[~azure.mgmt.appplatform.v2019_05_01_preview.models.AppResource] + :keyword next_link: URL client should use to fetch the next page (per server side paging). + It's null for now, added for future use. + :paramtype next_link: str + """ super(AppResourceCollection, self).__init__(**kwargs) self.value = kwargs.get('value', None) self.next_link = kwargs.get('next_link', None) @@ -149,26 +170,26 @@ class AppResourceProperties(msrest.serialization.Model): Variables are only populated by the server, and will be ignored when sending a request. - :param public: Indicates whether the App exposes public endpoint. - :type public: bool + :ivar public: Indicates whether the App exposes public endpoint. + :vartype public: bool :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". :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. - :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 active_deployment_name: Name of the active deployment of the App. + :vartype active_deployment_name: str + :ivar fqdn: Fully qualified dns Name. + :vartype fqdn: str + :ivar https_only: Indicate if only https is allowed. + :vartype https_only: bool :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 + :ivar temporary_disk: Temporary disk settings. + :vartype temporary_disk: ~azure.mgmt.appplatform.v2019_05_01_preview.models.TemporaryDisk + :ivar persistent_disk: Persistent disk settings. + :vartype persistent_disk: ~azure.mgmt.appplatform.v2019_05_01_preview.models.PersistentDisk """ _validation = { @@ -193,6 +214,20 @@ def __init__( self, **kwargs ): + """ + :keyword public: Indicates whether the App exposes public endpoint. + :paramtype public: bool + :keyword active_deployment_name: Name of the active deployment of the App. + :paramtype active_deployment_name: str + :keyword fqdn: Fully qualified dns Name. + :paramtype fqdn: str + :keyword https_only: Indicate if only https is allowed. + :paramtype https_only: bool + :keyword temporary_disk: Temporary disk settings. + :paramtype temporary_disk: ~azure.mgmt.appplatform.v2019_05_01_preview.models.TemporaryDisk + :keyword persistent_disk: Persistent disk settings. + :paramtype persistent_disk: ~azure.mgmt.appplatform.v2019_05_01_preview.models.PersistentDisk + """ super(AppResourceProperties, self).__init__(**kwargs) self.public = kwargs.get('public', None) self.url = None @@ -208,11 +243,11 @@ def __init__( 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). + :ivar value: Collection of available operation details. + :vartype value: list[~azure.mgmt.appplatform.v2019_05_01_preview.models.OperationDetail] + :ivar 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 + :vartype next_link: str """ _attribute_map = { @@ -224,6 +259,13 @@ def __init__( self, **kwargs ): + """ + :keyword value: Collection of available operation details. + :paramtype value: list[~azure.mgmt.appplatform.v2019_05_01_preview.models.OperationDetail] + :keyword next_link: URL client should use to fetch the next page (per server side paging). + It's null for now, added for future use. + :paramtype next_link: str + """ super(AvailableOperations, self).__init__(**kwargs) self.value = kwargs.get('value', None) self.next_link = kwargs.get('next_link', None) @@ -251,6 +293,8 @@ def __init__( self, **kwargs ): + """ + """ super(AvailableRuntimeVersions, self).__init__(**kwargs) self.value = None @@ -266,8 +310,9 @@ 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 + :ivar properties: Properties of the Binding resource. + :vartype properties: + ~azure.mgmt.appplatform.v2019_05_01_preview.models.BindingResourceProperties """ _validation = { @@ -287,6 +332,11 @@ def __init__( self, **kwargs ): + """ + :keyword properties: Properties of the Binding resource. + :paramtype properties: + ~azure.mgmt.appplatform.v2019_05_01_preview.models.BindingResourceProperties + """ super(BindingResource, self).__init__(**kwargs) self.properties = kwargs.get('properties', None) @@ -294,11 +344,11 @@ def __init__( 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). + :ivar value: Collection of Binding resources. + :vartype value: list[~azure.mgmt.appplatform.v2019_05_01_preview.models.BindingResource] + :ivar 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 + :vartype next_link: str """ _attribute_map = { @@ -310,6 +360,13 @@ def __init__( self, **kwargs ): + """ + :keyword value: Collection of Binding resources. + :paramtype value: list[~azure.mgmt.appplatform.v2019_05_01_preview.models.BindingResource] + :keyword next_link: URL client should use to fetch the next page (per server side paging). + It's null for now, added for future use. + :paramtype next_link: str + """ super(BindingResourceCollection, self).__init__(**kwargs) self.value = kwargs.get('value', None) self.next_link = kwargs.get('next_link', None) @@ -324,12 +381,12 @@ class BindingResourceProperties(msrest.serialization.Model): :vartype resource_name: str :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. - :type resource_id: str - :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, any] + :ivar resource_id: The Azure resource id of the bound resource. + :vartype resource_id: str + :ivar key: The key of the bound resource. + :vartype key: str + :ivar binding_parameters: Binding parameters of the Binding resource. + :vartype 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 @@ -362,6 +419,14 @@ def __init__( self, **kwargs ): + """ + :keyword resource_id: The Azure resource id of the bound resource. + :paramtype resource_id: str + :keyword key: The key of the bound resource. + :paramtype key: str + :keyword binding_parameters: Binding parameters of the Binding resource. + :paramtype binding_parameters: dict[str, any] + """ super(BindingResourceProperties, self).__init__(**kwargs) self.resource_name = None self.resource_type = None @@ -382,12 +447,12 @@ class CertificateProperties(msrest.serialization.Model): :ivar thumbprint: The thumbprint of certificate. :vartype thumbprint: str - :param vault_uri: Required. The vault uri of user key vault. - :type vault_uri: str - :param key_vault_cert_name: Required. The certificate name of key vault. - :type key_vault_cert_name: str - :param cert_version: The certificate version of key vault. - :type cert_version: str + :ivar vault_uri: Required. The vault uri of user key vault. + :vartype vault_uri: str + :ivar key_vault_cert_name: Required. The certificate name of key vault. + :vartype key_vault_cert_name: str + :ivar cert_version: The certificate version of key vault. + :vartype cert_version: str :ivar issuer: The issuer of certificate. :vartype issuer: str :ivar issued_date: The issue date of certificate. @@ -431,6 +496,14 @@ def __init__( self, **kwargs ): + """ + :keyword vault_uri: Required. The vault uri of user key vault. + :paramtype vault_uri: str + :keyword key_vault_cert_name: Required. The certificate name of key vault. + :paramtype key_vault_cert_name: str + :keyword cert_version: The certificate version of key vault. + :paramtype cert_version: str + """ super(CertificateProperties, self).__init__(**kwargs) self.thumbprint = None self.vault_uri = kwargs['vault_uri'] @@ -455,8 +528,8 @@ class CertificateResource(ProxyResource): :vartype name: str :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 + :ivar properties: Properties of the certificate resource payload. + :vartype properties: ~azure.mgmt.appplatform.v2019_05_01_preview.models.CertificateProperties """ _validation = { @@ -476,6 +549,10 @@ def __init__( self, **kwargs ): + """ + :keyword properties: Properties of the certificate resource payload. + :paramtype properties: ~azure.mgmt.appplatform.v2019_05_01_preview.models.CertificateProperties + """ super(CertificateResource, self).__init__(**kwargs) self.properties = kwargs.get('properties', None) @@ -483,10 +560,10 @@ def __init__( class CertificateResourceCollection(msrest.serialization.Model): """Collection compose of certificate resources list and a possible link for next page. - :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 + :ivar value: The certificate resources list. + :vartype value: list[~azure.mgmt.appplatform.v2019_05_01_preview.models.CertificateResource] + :ivar next_link: The link to next page of certificate list. + :vartype next_link: str """ _attribute_map = { @@ -498,6 +575,12 @@ def __init__( self, **kwargs ): + """ + :keyword value: The certificate resources list. + :paramtype value: list[~azure.mgmt.appplatform.v2019_05_01_preview.models.CertificateResource] + :keyword next_link: The link to next page of certificate list. + :paramtype next_link: str + """ super(CertificateResourceCollection, self).__init__(**kwargs) self.value = kwargs.get('value', None) self.next_link = kwargs.get('next_link', None) @@ -506,17 +589,17 @@ def __init__( 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 + :ivar 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 + :vartype code: str + :ivar 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 + :vartype message: str + :ivar 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] + :vartype target: str + :ivar details: A list of additional details about the error. + :vartype details: list[~azure.mgmt.appplatform.v2019_05_01_preview.models.CloudErrorBody] """ _attribute_map = { @@ -530,6 +613,19 @@ def __init__( self, **kwargs ): + """ + :keyword code: An identifier for the error. Codes are invariant and are intended to be consumed + programmatically. + :paramtype code: str + :keyword message: A message describing the error, intended to be suitable for display in a user + interface. + :paramtype message: str + :keyword target: The target of the particular error. For example, the name of the property in + error. + :paramtype target: str + :keyword details: A list of additional details about the error. + :paramtype details: list[~azure.mgmt.appplatform.v2019_05_01_preview.models.CloudErrorBody] + """ super(CloudErrorBody, self).__init__(**kwargs) self.code = kwargs.get('code', None) self.message = kwargs.get('message', None) @@ -547,13 +643,13 @@ class ClusterResourceProperties(msrest.serialization.Model): "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. - :type config_server_properties: + :ivar config_server_properties: Config server git properties of the Service. + :vartype 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 trace: Trace properties of the Service. + :vartype trace: ~azure.mgmt.appplatform.v2019_05_01_preview.models.TraceProperties + :ivar network_profile: Network profile of the Service. + :vartype 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. @@ -579,6 +675,15 @@ def __init__( self, **kwargs ): + """ + :keyword config_server_properties: Config server git properties of the Service. + :paramtype config_server_properties: + ~azure.mgmt.appplatform.v2019_05_01_preview.models.ConfigServerProperties + :keyword trace: Trace properties of the Service. + :paramtype trace: ~azure.mgmt.appplatform.v2019_05_01_preview.models.TraceProperties + :keyword network_profile: Network profile of the Service. + :paramtype network_profile: ~azure.mgmt.appplatform.v2019_05_01_preview.models.NetworkProfile + """ super(ClusterResourceProperties, self).__init__(**kwargs) self.provisioning_state = None self.config_server_properties = kwargs.get('config_server_properties', None) @@ -593,27 +698,27 @@ class ConfigServerGitProperty(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param repositories: Repositories of git. - :type repositories: + :ivar repositories: Repositories of git. + :vartype repositories: list[~azure.mgmt.appplatform.v2019_05_01_preview.models.GitPatternRepository] - :param uri: Required. URI of the repository. - :type uri: str - :param label: Label of the repository. - :type label: str - :param search_paths: Searching path of the repository. - :type search_paths: list[str] - :param username: Username of git repository basic auth. - :type username: str - :param password: Password of git repository basic auth. - :type password: str - :param host_key: Public sshKey of git repository. - :type host_key: str - :param host_key_algorithm: SshKey algorithm of git repository. - :type host_key_algorithm: str - :param private_key: Private sshKey algorithm of git repository. - :type private_key: str - :param strict_host_key_checking: Strict host key checking or not. - :type strict_host_key_checking: bool + :ivar uri: Required. URI of the repository. + :vartype uri: str + :ivar label: Label of the repository. + :vartype label: str + :ivar search_paths: Searching path of the repository. + :vartype search_paths: list[str] + :ivar username: Username of git repository basic auth. + :vartype username: str + :ivar password: Password of git repository basic auth. + :vartype password: str + :ivar host_key: Public sshKey of git repository. + :vartype host_key: str + :ivar host_key_algorithm: SshKey algorithm of git repository. + :vartype host_key_algorithm: str + :ivar private_key: Private sshKey algorithm of git repository. + :vartype private_key: str + :ivar strict_host_key_checking: Strict host key checking or not. + :vartype strict_host_key_checking: bool """ _validation = { @@ -637,6 +742,29 @@ def __init__( self, **kwargs ): + """ + :keyword repositories: Repositories of git. + :paramtype repositories: + list[~azure.mgmt.appplatform.v2019_05_01_preview.models.GitPatternRepository] + :keyword uri: Required. URI of the repository. + :paramtype uri: str + :keyword label: Label of the repository. + :paramtype label: str + :keyword search_paths: Searching path of the repository. + :paramtype search_paths: list[str] + :keyword username: Username of git repository basic auth. + :paramtype username: str + :keyword password: Password of git repository basic auth. + :paramtype password: str + :keyword host_key: Public sshKey of git repository. + :paramtype host_key: str + :keyword host_key_algorithm: SshKey algorithm of git repository. + :paramtype host_key_algorithm: str + :keyword private_key: Private sshKey algorithm of git repository. + :paramtype private_key: str + :keyword strict_host_key_checking: Strict host key checking or not. + :paramtype strict_host_key_checking: bool + """ super(ConfigServerGitProperty, self).__init__(**kwargs) self.repositories = kwargs.get('repositories', None) self.uri = kwargs['uri'] @@ -658,10 +786,10 @@ class ConfigServerProperties(msrest.serialization.Model): :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 + :ivar error: Error when apply config server settings. + :vartype error: ~azure.mgmt.appplatform.v2019_05_01_preview.models.Error + :ivar config_server: Settings of config server. + :vartype config_server: ~azure.mgmt.appplatform.v2019_05_01_preview.models.ConfigServerSettings """ _validation = { @@ -678,6 +806,13 @@ def __init__( self, **kwargs ): + """ + :keyword error: Error when apply config server settings. + :paramtype error: ~azure.mgmt.appplatform.v2019_05_01_preview.models.Error + :keyword config_server: Settings of config server. + :paramtype config_server: + ~azure.mgmt.appplatform.v2019_05_01_preview.models.ConfigServerSettings + """ super(ConfigServerProperties, self).__init__(**kwargs) self.state = None self.error = kwargs.get('error', None) @@ -687,8 +822,9 @@ def __init__( 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 + :ivar git_property: Property of git environment. + :vartype git_property: + ~azure.mgmt.appplatform.v2019_05_01_preview.models.ConfigServerGitProperty """ _attribute_map = { @@ -699,6 +835,11 @@ def __init__( self, **kwargs ): + """ + :keyword git_property: Property of git environment. + :paramtype git_property: + ~azure.mgmt.appplatform.v2019_05_01_preview.models.ConfigServerGitProperty + """ super(ConfigServerSettings, self).__init__(**kwargs) self.git_property = kwargs.get('git_property', None) @@ -708,12 +849,12 @@ class CustomDomainProperties(msrest.serialization.Model): 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 + :ivar thumbprint: The thumbprint of bound certificate. + :vartype thumbprint: str :ivar app_name: The app name of domain. :vartype app_name: str - :param cert_name: The bound certificate name of domain. - :type cert_name: str + :ivar cert_name: The bound certificate name of domain. + :vartype cert_name: str """ _validation = { @@ -730,6 +871,12 @@ def __init__( self, **kwargs ): + """ + :keyword thumbprint: The thumbprint of bound certificate. + :paramtype thumbprint: str + :keyword cert_name: The bound certificate name of domain. + :paramtype cert_name: str + """ super(CustomDomainProperties, self).__init__(**kwargs) self.thumbprint = kwargs.get('thumbprint', None) self.app_name = None @@ -747,8 +894,8 @@ class CustomDomainResource(ProxyResource): :vartype name: str :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 + :ivar properties: Properties of the custom domain resource. + :vartype properties: ~azure.mgmt.appplatform.v2019_05_01_preview.models.CustomDomainProperties """ _validation = { @@ -768,6 +915,11 @@ def __init__( self, **kwargs ): + """ + :keyword properties: Properties of the custom domain resource. + :paramtype properties: + ~azure.mgmt.appplatform.v2019_05_01_preview.models.CustomDomainProperties + """ super(CustomDomainResource, self).__init__(**kwargs) self.properties = kwargs.get('properties', None) @@ -775,10 +927,10 @@ def __init__( 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 + :ivar value: The custom domain resources list. + :vartype value: list[~azure.mgmt.appplatform.v2019_05_01_preview.models.CustomDomainResource] + :ivar next_link: The link to next page of custom domain list. + :vartype next_link: str """ _attribute_map = { @@ -790,6 +942,12 @@ def __init__( self, **kwargs ): + """ + :keyword value: The custom domain resources list. + :paramtype value: list[~azure.mgmt.appplatform.v2019_05_01_preview.models.CustomDomainResource] + :keyword next_link: The link to next page of custom domain list. + :paramtype next_link: str + """ super(CustomDomainResourceCollection, self).__init__(**kwargs) self.value = kwargs.get('value', None) self.next_link = kwargs.get('next_link', None) @@ -800,8 +958,8 @@ class CustomDomainValidatePayload(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param name: Required. Name to be validated. - :type name: str + :ivar name: Required. Name to be validated. + :vartype name: str """ _validation = { @@ -816,6 +974,10 @@ def __init__( self, **kwargs ): + """ + :keyword name: Required. Name to be validated. + :paramtype name: str + """ super(CustomDomainValidatePayload, self).__init__(**kwargs) self.name = kwargs['name'] @@ -823,10 +985,10 @@ def __init__( class CustomDomainValidateResult(msrest.serialization.Model): """Validation result for custom domain. - :param is_valid: Indicates if domain name is valid. - :type is_valid: bool - :param message: Message of why domain name is invalid. - :type message: str + :ivar is_valid: Indicates if domain name is valid. + :vartype is_valid: bool + :ivar message: Message of why domain name is invalid. + :vartype message: str """ _attribute_map = { @@ -838,6 +1000,12 @@ def __init__( self, **kwargs ): + """ + :keyword is_valid: Indicates if domain name is valid. + :paramtype is_valid: bool + :keyword message: Message of why domain name is invalid. + :paramtype message: str + """ super(CustomDomainValidateResult, self).__init__(**kwargs) self.is_valid = kwargs.get('is_valid', None) self.message = kwargs.get('message', None) @@ -880,6 +1048,8 @@ def __init__( self, **kwargs ): + """ + """ super(DeploymentInstance, self).__init__(**kwargs) self.name = None self.status = None @@ -899,11 +1069,11 @@ 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: + :ivar properties: Properties of the Deployment resource. + :vartype 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 + :ivar sku: Sku of the Deployment resource. + :vartype sku: ~azure.mgmt.appplatform.v2019_05_01_preview.models.Sku """ _validation = { @@ -924,6 +1094,13 @@ def __init__( self, **kwargs ): + """ + :keyword properties: Properties of the Deployment resource. + :paramtype properties: + ~azure.mgmt.appplatform.v2019_05_01_preview.models.DeploymentResourceProperties + :keyword sku: Sku of the Deployment resource. + :paramtype sku: ~azure.mgmt.appplatform.v2019_05_01_preview.models.Sku + """ super(DeploymentResource, self).__init__(**kwargs) self.properties = kwargs.get('properties', None) self.sku = kwargs.get('sku', None) @@ -932,11 +1109,11 @@ def __init__( 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). + :ivar value: Collection of Deployment resources. + :vartype value: list[~azure.mgmt.appplatform.v2019_05_01_preview.models.DeploymentResource] + :ivar 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 + :vartype next_link: str """ _attribute_map = { @@ -948,6 +1125,13 @@ def __init__( self, **kwargs ): + """ + :keyword value: Collection of Deployment resources. + :paramtype value: list[~azure.mgmt.appplatform.v2019_05_01_preview.models.DeploymentResource] + :keyword next_link: URL client should use to fetch the next page (per server side paging). + It's null for now, added for future use. + :paramtype next_link: str + """ super(DeploymentResourceCollection, self).__init__(**kwargs) self.value = kwargs.get('value', None) self.next_link = kwargs.get('next_link', None) @@ -958,12 +1142,12 @@ class DeploymentResourceProperties(msrest.serialization.Model): 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 source: Uploaded source information of the deployment. + :vartype 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. - :type deployment_settings: + :ivar deployment_settings: Deployment settings of the Deployment. + :vartype 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". @@ -1005,6 +1189,13 @@ def __init__( self, **kwargs ): + """ + :keyword source: Uploaded source information of the deployment. + :paramtype source: ~azure.mgmt.appplatform.v2019_05_01_preview.models.UserSourceInfo + :keyword deployment_settings: Deployment settings of the Deployment. + :paramtype deployment_settings: + ~azure.mgmt.appplatform.v2019_05_01_preview.models.DeploymentSettings + """ super(DeploymentResourceProperties, self).__init__(**kwargs) self.source = kwargs.get('source', None) self.app_name = None @@ -1019,23 +1210,24 @@ def __init__( 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). - :type cpu: int - :param memory_in_gb: Required Memory size in GB, basic tier should be in range (1, 2), standard + :ivar cpu: Required CPU, basic tier should be 1, standard tier should be in range (1, 4). + :vartype cpu: int + :ivar 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. - :type jvm_options: str - :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 + :vartype memory_in_gb: int + :ivar jvm_options: JVM parameter. + :vartype jvm_options: str + :ivar net_core_main_entry_path: The path to the .NET executable relative to zip root. + :vartype net_core_main_entry_path: str + :ivar 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. - :type environment_variables: dict[str, str] - :param runtime_version: Runtime version. Possible values include: "Java_8", "Java_11", + :vartype instance_count: int + :ivar environment_variables: Collection of environment variables. + :vartype environment_variables: dict[str, str] + :ivar 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 + :vartype runtime_version: str or + ~azure.mgmt.appplatform.v2019_05_01_preview.models.RuntimeVersion """ _attribute_map = { @@ -1052,6 +1244,26 @@ def __init__( self, **kwargs ): + """ + :keyword cpu: Required CPU, basic tier should be 1, standard tier should be in range (1, 4). + :paramtype cpu: int + :keyword memory_in_gb: Required Memory size in GB, basic tier should be in range (1, 2), + standard tier should be in range (1, 8). + :paramtype memory_in_gb: int + :keyword jvm_options: JVM parameter. + :paramtype jvm_options: str + :keyword net_core_main_entry_path: The path to the .NET executable relative to zip root. + :paramtype net_core_main_entry_path: str + :keyword instance_count: Instance count, basic tier should be in range (1, 25), standard tier + should be in range (1, 500). + :paramtype instance_count: int + :keyword environment_variables: Collection of environment variables. + :paramtype environment_variables: dict[str, str] + :keyword runtime_version: Runtime version. Possible values include: "Java_8", "Java_11", + "NetCore_31". Default value: "Java_8". + :paramtype runtime_version: str or + ~azure.mgmt.appplatform.v2019_05_01_preview.models.RuntimeVersion + """ super(DeploymentSettings, self).__init__(**kwargs) self.cpu = kwargs.get('cpu', 1) self.memory_in_gb = kwargs.get('memory_in_gb', 1) @@ -1065,10 +1277,10 @@ def __init__( class Error(msrest.serialization.Model): """The error code compose of code and message. - :param code: The code of error. - :type code: str - :param message: The message of error. - :type message: str + :ivar code: The code of error. + :vartype code: str + :ivar message: The message of error. + :vartype message: str """ _attribute_map = { @@ -1080,6 +1292,12 @@ def __init__( self, **kwargs ): + """ + :keyword code: The code of error. + :paramtype code: str + :keyword message: The message of error. + :paramtype message: str + """ super(Error, self).__init__(**kwargs) self.code = kwargs.get('code', None) self.message = kwargs.get('message', None) @@ -1090,28 +1308,28 @@ class GitPatternRepository(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param name: Required. Name of the repository. - :type name: str - :param pattern: Collection of pattern of the repository. - :type pattern: list[str] - :param uri: Required. URI of the repository. - :type uri: str - :param label: Label of the repository. - :type label: str - :param search_paths: Searching path of the repository. - :type search_paths: list[str] - :param username: Username of git repository basic auth. - :type username: str - :param password: Password of git repository basic auth. - :type password: str - :param host_key: Public sshKey of git repository. - :type host_key: str - :param host_key_algorithm: SshKey algorithm of git repository. - :type host_key_algorithm: str - :param private_key: Private sshKey algorithm of git repository. - :type private_key: str - :param strict_host_key_checking: Strict host key checking or not. - :type strict_host_key_checking: bool + :ivar name: Required. Name of the repository. + :vartype name: str + :ivar pattern: Collection of pattern of the repository. + :vartype pattern: list[str] + :ivar uri: Required. URI of the repository. + :vartype uri: str + :ivar label: Label of the repository. + :vartype label: str + :ivar search_paths: Searching path of the repository. + :vartype search_paths: list[str] + :ivar username: Username of git repository basic auth. + :vartype username: str + :ivar password: Password of git repository basic auth. + :vartype password: str + :ivar host_key: Public sshKey of git repository. + :vartype host_key: str + :ivar host_key_algorithm: SshKey algorithm of git repository. + :vartype host_key_algorithm: str + :ivar private_key: Private sshKey algorithm of git repository. + :vartype private_key: str + :ivar strict_host_key_checking: Strict host key checking or not. + :vartype strict_host_key_checking: bool """ _validation = { @@ -1137,6 +1355,30 @@ def __init__( self, **kwargs ): + """ + :keyword name: Required. Name of the repository. + :paramtype name: str + :keyword pattern: Collection of pattern of the repository. + :paramtype pattern: list[str] + :keyword uri: Required. URI of the repository. + :paramtype uri: str + :keyword label: Label of the repository. + :paramtype label: str + :keyword search_paths: Searching path of the repository. + :paramtype search_paths: list[str] + :keyword username: Username of git repository basic auth. + :paramtype username: str + :keyword password: Password of git repository basic auth. + :paramtype password: str + :keyword host_key: Public sshKey of git repository. + :paramtype host_key: str + :keyword host_key_algorithm: SshKey algorithm of git repository. + :paramtype host_key_algorithm: str + :keyword private_key: Private sshKey algorithm of git repository. + :paramtype private_key: str + :keyword strict_host_key_checking: Strict host key checking or not. + :paramtype strict_host_key_checking: bool + """ super(GitPatternRepository, self).__init__(**kwargs) self.name = kwargs['name'] self.pattern = kwargs.get('pattern', None) @@ -1156,8 +1398,8 @@ class LogFileUrlResponse(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param url: Required. URL of the log file. - :type url: str + :ivar url: Required. URL of the log file. + :vartype url: str """ _validation = { @@ -1172,6 +1414,10 @@ def __init__( self, **kwargs ): + """ + :keyword url: Required. URL of the log file. + :paramtype url: str + """ super(LogFileUrlResponse, self).__init__(**kwargs) self.url = kwargs['url'] @@ -1179,12 +1425,12 @@ def __init__( class LogSpecification(msrest.serialization.Model): """Specifications of the Log for Azure Monitoring. - :param name: Name of the log. - :type name: str - :param display_name: Localized friendly display name of the log. - :type display_name: str - :param blob_duration: Blob duration of the log. - :type blob_duration: str + :ivar name: Name of the log. + :vartype name: str + :ivar display_name: Localized friendly display name of the log. + :vartype display_name: str + :ivar blob_duration: Blob duration of the log. + :vartype blob_duration: str """ _attribute_map = { @@ -1197,6 +1443,14 @@ def __init__( self, **kwargs ): + """ + :keyword name: Name of the log. + :paramtype name: str + :keyword display_name: Localized friendly display name of the log. + :paramtype display_name: str + :keyword blob_duration: Blob duration of the log. + :paramtype blob_duration: str + """ super(LogSpecification, self).__init__(**kwargs) self.name = kwargs.get('name', None) self.display_name = kwargs.get('display_name', None) @@ -1206,13 +1460,13 @@ def __init__( class ManagedIdentityProperties(msrest.serialization.Model): """Managed identity properties retrieved from ARM request headers. - :param type: Possible values include: "None", "SystemAssigned", "UserAssigned", + :ivar 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: - :type tenant_id: str + :vartype type: str or ~azure.mgmt.appplatform.v2019_05_01_preview.models.ManagedIdentityType + :ivar principal_id: + :vartype principal_id: str + :ivar tenant_id: + :vartype tenant_id: str """ _attribute_map = { @@ -1225,6 +1479,15 @@ def __init__( self, **kwargs ): + """ + :keyword type: Possible values include: "None", "SystemAssigned", "UserAssigned", + "SystemAssigned,UserAssigned". + :paramtype type: str or ~azure.mgmt.appplatform.v2019_05_01_preview.models.ManagedIdentityType + :keyword principal_id: + :paramtype principal_id: str + :keyword tenant_id: + :paramtype tenant_id: str + """ super(ManagedIdentityProperties, self).__init__(**kwargs) self.type = kwargs.get('type', None) self.principal_id = kwargs.get('principal_id', None) @@ -1234,13 +1497,13 @@ def __init__( class MetricDimension(msrest.serialization.Model): """Specifications of the Dimension of metrics. - :param name: Name of the dimension. - :type name: str - :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 + :ivar name: Name of the dimension. + :vartype name: str + :ivar display_name: Localized friendly display name of the dimension. + :vartype display_name: str + :ivar to_be_exported_for_shoebox: Whether this dimension should be included for the Shoebox export scenario. - :type to_be_exported_for_shoebox: bool + :vartype to_be_exported_for_shoebox: bool """ _attribute_map = { @@ -1253,6 +1516,15 @@ def __init__( self, **kwargs ): + """ + :keyword name: Name of the dimension. + :paramtype name: str + :keyword display_name: Localized friendly display name of the dimension. + :paramtype display_name: str + :keyword to_be_exported_for_shoebox: Whether this dimension should be included for the Shoebox + export scenario. + :paramtype to_be_exported_for_shoebox: bool + """ super(MetricDimension, self).__init__(**kwargs) self.name = kwargs.get('name', None) self.display_name = kwargs.get('display_name', None) @@ -1262,29 +1534,31 @@ def __init__( class MetricSpecification(msrest.serialization.Model): """Specifications of the Metrics for Azure Monitoring. - :param name: Name of the metric. - :type name: str - :param display_name: Localized friendly display name of the metric. - :type display_name: str - :param display_description: Localized friendly description of the metric. - :type display_description: str - :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 + :ivar name: Name of the metric. + :vartype name: str + :ivar display_name: Localized friendly display name of the metric. + :vartype display_name: str + :ivar display_description: Localized friendly description of the metric. + :vartype display_description: str + :ivar unit: Unit that makes sense for the metric. + :vartype unit: str + :ivar 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, + :vartype category: str + :ivar 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. - :type supported_aggregation_types: list[str] - :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 + :vartype aggregation_type: str + :ivar supported_aggregation_types: Supported aggregation types. + :vartype supported_aggregation_types: list[str] + :ivar supported_time_grain_types: Supported time grain types. + :vartype supported_time_grain_types: list[str] + :ivar 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] + :vartype fill_gap_with_zero: bool + :ivar dimensions: Dimensions of the metric. + :vartype dimensions: list[~azure.mgmt.appplatform.v2019_05_01_preview.models.MetricDimension] + :ivar source_mdm_namespace: Name of the MDM namespace. Optional. + :vartype source_mdm_namespace: str """ _attribute_map = { @@ -1298,12 +1572,40 @@ class MetricSpecification(msrest.serialization.Model): 'supported_time_grain_types': {'key': 'supportedTimeGrainTypes', 'type': '[str]'}, 'fill_gap_with_zero': {'key': 'fillGapWithZero', 'type': 'bool'}, 'dimensions': {'key': 'dimensions', 'type': '[MetricDimension]'}, - } - - def __init__( - self, - **kwargs - ): + 'source_mdm_namespace': {'key': 'sourceMdmNamespace', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + """ + :keyword name: Name of the metric. + :paramtype name: str + :keyword display_name: Localized friendly display name of the metric. + :paramtype display_name: str + :keyword display_description: Localized friendly description of the metric. + :paramtype display_description: str + :keyword unit: Unit that makes sense for the metric. + :paramtype unit: str + :keyword category: Name of the metric category that the metric belongs to. A metric can only + belong to a single category. + :paramtype category: str + :keyword aggregation_type: Only provide one value for this field. Valid values: Average, + Minimum, Maximum, Total, Count. + :paramtype aggregation_type: str + :keyword supported_aggregation_types: Supported aggregation types. + :paramtype supported_aggregation_types: list[str] + :keyword supported_time_grain_types: Supported time grain types. + :paramtype supported_time_grain_types: list[str] + :keyword fill_gap_with_zero: Optional. If set to true, then zero will be returned for time + duration where no metric is emitted/published. + :paramtype fill_gap_with_zero: bool + :keyword dimensions: Dimensions of the metric. + :paramtype dimensions: list[~azure.mgmt.appplatform.v2019_05_01_preview.models.MetricDimension] + :keyword source_mdm_namespace: Name of the MDM namespace. Optional. + :paramtype source_mdm_namespace: str + """ super(MetricSpecification, self).__init__(**kwargs) self.name = kwargs.get('name', None) self.display_name = kwargs.get('display_name', None) @@ -1315,17 +1617,18 @@ def __init__( self.supported_time_grain_types = kwargs.get('supported_time_grain_types', None) self.fill_gap_with_zero = kwargs.get('fill_gap_with_zero', None) self.dimensions = kwargs.get('dimensions', None) + self.source_mdm_namespace = kwargs.get('source_mdm_namespace', None) class NameAvailability(msrest.serialization.Model): """Name availability result payload. - :param name_available: Indicates whether the name is available. - :type name_available: bool - :param reason: Reason why the name is not available. - :type reason: str - :param message: Message why the name is not available. - :type message: str + :ivar name_available: Indicates whether the name is available. + :vartype name_available: bool + :ivar reason: Reason why the name is not available. + :vartype reason: str + :ivar message: Message why the name is not available. + :vartype message: str """ _attribute_map = { @@ -1338,6 +1641,14 @@ def __init__( self, **kwargs ): + """ + :keyword name_available: Indicates whether the name is available. + :paramtype name_available: bool + :keyword reason: Reason why the name is not available. + :paramtype reason: str + :keyword message: Message why the name is not available. + :paramtype message: str + """ super(NameAvailability, self).__init__(**kwargs) self.name_available = kwargs.get('name_available', None) self.reason = kwargs.get('reason', None) @@ -1349,10 +1660,10 @@ class NameAvailabilityParameters(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param type: Required. Type of the resource to check name availability. - :type type: str - :param name: Required. Name to be checked. - :type name: str + :ivar type: Required. Type of the resource to check name availability. + :vartype type: str + :ivar name: Required. Name to be checked. + :vartype name: str """ _validation = { @@ -1369,6 +1680,12 @@ def __init__( self, **kwargs ): + """ + :keyword type: Required. Type of the resource to check name availability. + :paramtype type: str + :keyword name: Required. Name to be checked. + :paramtype name: str + """ super(NameAvailabilityParameters, self).__init__(**kwargs) self.type = kwargs['type'] self.name = kwargs['name'] @@ -1379,20 +1696,19 @@ class NetworkProfile(msrest.serialization.Model): 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. - :type service_runtime_subnet_id: str - :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. - :type service_cidr: str - :param service_runtime_network_resource_group: Name of the resource group containing network + :ivar service_runtime_subnet_id: Fully qualified resource Id of the subnet to host Azure Spring + Cloud Service Runtime. + :vartype service_runtime_subnet_id: str + :ivar app_subnet_id: Fully qualified resource Id of the subnet to host Azure Spring Cloud Apps. + :vartype app_subnet_id: str + :ivar service_cidr: Azure Spring Cloud service reserved CIDR. + :vartype service_cidr: str + :ivar 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 + :vartype service_runtime_network_resource_group: str + :ivar app_network_resource_group: Name of the resource group containing network resources of Azure Spring Cloud Apps. - :type app_network_resource_group: str + :vartype app_network_resource_group: str :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 @@ -1420,6 +1736,22 @@ def __init__( self, **kwargs ): + """ + :keyword service_runtime_subnet_id: Fully qualified resource Id of the subnet to host Azure + Spring Cloud Service Runtime. + :paramtype service_runtime_subnet_id: str + :keyword app_subnet_id: Fully qualified resource Id of the subnet to host Azure Spring Cloud + Apps. + :paramtype app_subnet_id: str + :keyword service_cidr: Azure Spring Cloud service reserved CIDR. + :paramtype service_cidr: str + :keyword service_runtime_network_resource_group: Name of the resource group containing network + resources of Azure Spring Cloud Service Runtime. + :paramtype service_runtime_network_resource_group: str + :keyword app_network_resource_group: Name of the resource group containing network resources of + Azure Spring Cloud Apps. + :paramtype app_network_resource_group: str + """ 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) @@ -1451,6 +1783,8 @@ def __init__( self, **kwargs ): + """ + """ super(NetworkProfileOutboundIPs, self).__init__(**kwargs) self.public_i_ps = None @@ -1458,22 +1792,32 @@ def __init__( class OperationDetail(msrest.serialization.Model): """Operation detail payload. - :param name: Name of the operation. - :type name: str - :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. - :type origin: str - :param properties: Properties of the operation. - :type properties: ~azure.mgmt.appplatform.v2019_05_01_preview.models.OperationProperties + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar name: Name of the operation. + :vartype name: str + :ivar is_data_action: Indicates whether the operation is a data action. + :vartype is_data_action: bool + :ivar display: Display of the operation. + :vartype display: ~azure.mgmt.appplatform.v2019_05_01_preview.models.OperationDisplay + :ivar action_type: Enum. Indicates the action type. "Internal" refers to actions that are for + internal only APIs. Possible values include: "Internal". + :vartype action_type: str or ~azure.mgmt.appplatform.v2019_05_01_preview.models.ActionType + :ivar origin: Origin of the operation. + :vartype origin: str + :ivar properties: Properties of the operation. + :vartype properties: ~azure.mgmt.appplatform.v2019_05_01_preview.models.OperationProperties """ + _validation = { + 'action_type': {'readonly': True}, + } + _attribute_map = { 'name': {'key': 'name', 'type': 'str'}, 'is_data_action': {'key': 'isDataAction', 'type': 'bool'}, 'display': {'key': 'display', 'type': 'OperationDisplay'}, + 'action_type': {'key': 'actionType', 'type': 'str'}, 'origin': {'key': 'origin', 'type': 'str'}, 'properties': {'key': 'properties', 'type': 'OperationProperties'}, } @@ -1482,10 +1826,23 @@ def __init__( self, **kwargs ): + """ + :keyword name: Name of the operation. + :paramtype name: str + :keyword is_data_action: Indicates whether the operation is a data action. + :paramtype is_data_action: bool + :keyword display: Display of the operation. + :paramtype display: ~azure.mgmt.appplatform.v2019_05_01_preview.models.OperationDisplay + :keyword origin: Origin of the operation. + :paramtype origin: str + :keyword properties: Properties of the operation. + :paramtype properties: ~azure.mgmt.appplatform.v2019_05_01_preview.models.OperationProperties + """ super(OperationDetail, self).__init__(**kwargs) self.name = kwargs.get('name', None) self.is_data_action = kwargs.get('is_data_action', None) self.display = kwargs.get('display', None) + self.action_type = None self.origin = kwargs.get('origin', None) self.properties = kwargs.get('properties', None) @@ -1493,14 +1850,14 @@ def __init__( class OperationDisplay(msrest.serialization.Model): """Operation display payload. - :param provider: Resource provider of the operation. - :type provider: str - :param resource: Resource of the operation. - :type resource: str - :param operation: Localized friendly name for the operation. - :type operation: str - :param description: Localized friendly description for the operation. - :type description: str + :ivar provider: Resource provider of the operation. + :vartype provider: str + :ivar resource: Resource of the operation. + :vartype resource: str + :ivar operation: Localized friendly name for the operation. + :vartype operation: str + :ivar description: Localized friendly description for the operation. + :vartype description: str """ _attribute_map = { @@ -1514,6 +1871,16 @@ def __init__( self, **kwargs ): + """ + :keyword provider: Resource provider of the operation. + :paramtype provider: str + :keyword resource: Resource of the operation. + :paramtype resource: str + :keyword operation: Localized friendly name for the operation. + :paramtype operation: str + :keyword description: Localized friendly description for the operation. + :paramtype description: str + """ super(OperationDisplay, self).__init__(**kwargs) self.provider = kwargs.get('provider', None) self.resource = kwargs.get('resource', None) @@ -1524,8 +1891,8 @@ def __init__( class OperationProperties(msrest.serialization.Model): """Extra Operation properties. - :param service_specification: Service specifications of the operation. - :type service_specification: + :ivar service_specification: Service specifications of the operation. + :vartype service_specification: ~azure.mgmt.appplatform.v2019_05_01_preview.models.ServiceSpecification """ @@ -1537,6 +1904,11 @@ def __init__( self, **kwargs ): + """ + :keyword service_specification: Service specifications of the operation. + :paramtype service_specification: + ~azure.mgmt.appplatform.v2019_05_01_preview.models.ServiceSpecification + """ super(OperationProperties, self).__init__(**kwargs) self.service_specification = kwargs.get('service_specification', None) @@ -1546,12 +1918,12 @@ class PersistentDisk(msrest.serialization.Model): 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. - :type size_in_gb: int + :ivar size_in_gb: Size of the persistent disk in GB. + :vartype size_in_gb: int :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. - :type mount_path: str + :ivar mount_path: Mount path of the persistent disk. + :vartype mount_path: str """ _validation = { @@ -1569,6 +1941,12 @@ def __init__( self, **kwargs ): + """ + :keyword size_in_gb: Size of the persistent disk in GB. + :paramtype size_in_gb: int + :keyword mount_path: Mount path of the persistent disk. + :paramtype mount_path: str + """ super(PersistentDisk, self).__init__(**kwargs) self.size_in_gb = kwargs.get('size_in_gb', None) self.used_in_gb = None @@ -1580,9 +1958,9 @@ class RegenerateTestKeyRequestPayload(msrest.serialization.Model): 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", + :ivar 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 + :vartype key_type: str or ~azure.mgmt.appplatform.v2019_05_01_preview.models.TestKeyType """ _validation = { @@ -1597,6 +1975,11 @@ def __init__( self, **kwargs ): + """ + :keyword key_type: Required. Type of the test key. Possible values include: "Primary", + "Secondary". + :paramtype key_type: str or ~azure.mgmt.appplatform.v2019_05_01_preview.models.TestKeyType + """ super(RegenerateTestKeyRequestPayload, self).__init__(**kwargs) self.key_type = kwargs['key_type'] @@ -1639,6 +2022,8 @@ def __init__( self, **kwargs ): + """ + """ super(RequiredTraffic, self).__init__(**kwargs) self.protocol = None self.port = None @@ -1650,23 +2035,23 @@ def __init__( class ResourceSku(msrest.serialization.Model): """Describes an available Azure Spring Cloud SKU. - :param resource_type: Gets the type of resource the SKU applies to. - :type resource_type: str - :param name: Gets the name of SKU. - :type name: str - :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 - :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 + :ivar resource_type: Gets the type of resource the SKU applies to. + :vartype resource_type: str + :ivar name: Gets the name of SKU. + :vartype name: str + :ivar tier: Gets the tier of SKU. + :vartype tier: str + :ivar capacity: Gets the capacity of SKU. + :vartype capacity: ~azure.mgmt.appplatform.v2019_05_01_preview.models.SkuCapacity + :ivar locations: Gets the set of locations that the SKU is available. + :vartype locations: list[str] + :ivar location_info: Gets a list of locations and availability zones in those locations where the SKU is available. - :type location_info: + :vartype 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 + :ivar restrictions: Gets the restrictions because of which SKU cannot be used. This is empty if there are no restrictions. - :type restrictions: + :vartype restrictions: list[~azure.mgmt.appplatform.v2019_05_01_preview.models.ResourceSkuRestrictions] """ @@ -1684,6 +2069,26 @@ def __init__( self, **kwargs ): + """ + :keyword resource_type: Gets the type of resource the SKU applies to. + :paramtype resource_type: str + :keyword name: Gets the name of SKU. + :paramtype name: str + :keyword tier: Gets the tier of SKU. + :paramtype tier: str + :keyword capacity: Gets the capacity of SKU. + :paramtype capacity: ~azure.mgmt.appplatform.v2019_05_01_preview.models.SkuCapacity + :keyword locations: Gets the set of locations that the SKU is available. + :paramtype locations: list[str] + :keyword location_info: Gets a list of locations and availability zones in those locations + where the SKU is available. + :paramtype location_info: + list[~azure.mgmt.appplatform.v2019_05_01_preview.models.ResourceSkuLocationInfo] + :keyword restrictions: Gets the restrictions because of which SKU cannot be used. This is + empty if there are no restrictions. + :paramtype restrictions: + list[~azure.mgmt.appplatform.v2019_05_01_preview.models.ResourceSkuRestrictions] + """ super(ResourceSku, self).__init__(**kwargs) self.resource_type = kwargs.get('resource_type', None) self.name = kwargs.get('name', None) @@ -1697,10 +2102,10 @@ def __init__( class ResourceSkuCapabilities(msrest.serialization.Model): """ResourceSkuCapabilities. - :param name: Gets an invariant to describe the feature. - :type name: str - :param value: Gets an invariant if the feature is measured by quantity. - :type value: str + :ivar name: Gets an invariant to describe the feature. + :vartype name: str + :ivar value: Gets an invariant if the feature is measured by quantity. + :vartype value: str """ _attribute_map = { @@ -1712,6 +2117,12 @@ def __init__( self, **kwargs ): + """ + :keyword name: Gets an invariant to describe the feature. + :paramtype name: str + :keyword value: Gets an invariant if the feature is measured by quantity. + :paramtype value: str + """ super(ResourceSkuCapabilities, self).__init__(**kwargs) self.name = kwargs.get('name', None) self.value = kwargs.get('value', None) @@ -1720,11 +2131,11 @@ def __init__( 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). + :ivar value: Collection of resource SKU. + :vartype value: list[~azure.mgmt.appplatform.v2019_05_01_preview.models.ResourceSku] + :ivar 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 + :vartype next_link: str """ _attribute_map = { @@ -1736,6 +2147,13 @@ def __init__( self, **kwargs ): + """ + :keyword value: Collection of resource SKU. + :paramtype value: list[~azure.mgmt.appplatform.v2019_05_01_preview.models.ResourceSku] + :keyword next_link: URL client should use to fetch the next page (per server side paging). + It's null for now, added for future use. + :paramtype next_link: str + """ super(ResourceSkuCollection, self).__init__(**kwargs) self.value = kwargs.get('value', None) self.next_link = kwargs.get('next_link', None) @@ -1744,12 +2162,12 @@ def __init__( class ResourceSkuLocationInfo(msrest.serialization.Model): """ResourceSkuLocationInfo. - :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: + :ivar location: Gets location of the SKU. + :vartype location: str + :ivar zones: Gets list of availability zones where the SKU is supported. + :vartype zones: list[str] + :ivar zone_details: Gets details of capabilities available to a SKU in specific zones. + :vartype zone_details: list[~azure.mgmt.appplatform.v2019_05_01_preview.models.ResourceSkuZoneDetails] """ @@ -1763,6 +2181,15 @@ def __init__( self, **kwargs ): + """ + :keyword location: Gets location of the SKU. + :paramtype location: str + :keyword zones: Gets list of availability zones where the SKU is supported. + :paramtype zones: list[str] + :keyword zone_details: Gets details of capabilities available to a SKU in specific zones. + :paramtype zone_details: + list[~azure.mgmt.appplatform.v2019_05_01_preview.models.ResourceSkuZoneDetails] + """ super(ResourceSkuLocationInfo, self).__init__(**kwargs) self.location = kwargs.get('location', None) self.zones = kwargs.get('zones', None) @@ -1772,10 +2199,10 @@ def __init__( class ResourceSkuRestrictionInfo(msrest.serialization.Model): """ResourceSkuRestrictionInfo. - :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] + :ivar locations: Gets locations where the SKU is restricted. + :vartype locations: list[str] + :ivar zones: Gets list of availability zones where the SKU is restricted. + :vartype zones: list[str] """ _attribute_map = { @@ -1787,6 +2214,12 @@ def __init__( self, **kwargs ): + """ + :keyword locations: Gets locations where the SKU is restricted. + :paramtype locations: list[str] + :keyword zones: Gets list of availability zones where the SKU is restricted. + :paramtype zones: list[str] + """ super(ResourceSkuRestrictionInfo, self).__init__(**kwargs) self.locations = kwargs.get('locations', None) self.zones = kwargs.get('zones', None) @@ -1795,21 +2228,21 @@ def __init__( class ResourceSkuRestrictions(msrest.serialization.Model): """ResourceSkuRestrictions. - :param type: Gets the type of restrictions. Possible values include: 'Location', 'Zone'. + :ivar type: Gets the type of restrictions. Possible values include: 'Location', 'Zone'. Possible values include: "Location", "Zone". - :type type: str or + :vartype 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 + :ivar 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 + :vartype values: list[str] + :ivar restriction_info: Gets the information about the restriction where the SKU cannot be used. - :type restriction_info: + :vartype restriction_info: ~azure.mgmt.appplatform.v2019_05_01_preview.models.ResourceSkuRestrictionInfo - :param reason_code: Gets the reason for restriction. Possible values include: 'QuotaId', + :ivar reason_code: Gets the reason for restriction. Possible values include: 'QuotaId', 'NotAvailableForSubscription'. Possible values include: "QuotaId", "NotAvailableForSubscription". - :type reason_code: str or + :vartype reason_code: str or ~azure.mgmt.appplatform.v2019_05_01_preview.models.ResourceSkuRestrictionsReasonCode """ @@ -1824,6 +2257,24 @@ def __init__( self, **kwargs ): + """ + :keyword type: Gets the type of restrictions. Possible values include: 'Location', 'Zone'. + Possible values include: "Location", "Zone". + :paramtype type: str or + ~azure.mgmt.appplatform.v2019_05_01_preview.models.ResourceSkuRestrictionsType + :keyword values: Gets the value of restrictions. If the restriction type is set to + location. This would be different locations where the SKU is restricted. + :paramtype values: list[str] + :keyword restriction_info: Gets the information about the restriction where the SKU cannot be + used. + :paramtype restriction_info: + ~azure.mgmt.appplatform.v2019_05_01_preview.models.ResourceSkuRestrictionInfo + :keyword reason_code: Gets the reason for restriction. Possible values include: 'QuotaId', + 'NotAvailableForSubscription'. Possible values include: "QuotaId", + "NotAvailableForSubscription". + :paramtype reason_code: str or + ~azure.mgmt.appplatform.v2019_05_01_preview.models.ResourceSkuRestrictionsReasonCode + """ super(ResourceSkuRestrictions, self).__init__(**kwargs) self.type = kwargs.get('type', None) self.values = kwargs.get('values', None) @@ -1834,12 +2285,12 @@ def __init__( class ResourceSkuZoneDetails(msrest.serialization.Model): """ResourceSkuZoneDetails. - :param name: Gets the set of zones that the SKU is available in with the + :ivar 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 + :vartype name: list[str] + :ivar capabilities: Gets a list of capabilities that are available for the SKU in the specified list of zones. - :type capabilities: + :vartype capabilities: list[~azure.mgmt.appplatform.v2019_05_01_preview.models.ResourceSkuCapabilities] """ @@ -1852,6 +2303,15 @@ def __init__( self, **kwargs ): + """ + :keyword name: Gets the set of zones that the SKU is available in with the + specified capabilities. + :paramtype name: list[str] + :keyword capabilities: Gets a list of capabilities that are available for the SKU in the + specified list of zones. + :paramtype capabilities: + list[~azure.mgmt.appplatform.v2019_05_01_preview.models.ResourceSkuCapabilities] + """ super(ResourceSkuZoneDetails, self).__init__(**kwargs) self.name = kwargs.get('name', None) self.capabilities = kwargs.get('capabilities', None) @@ -1860,10 +2320,10 @@ def __init__( class ResourceUploadDefinition(msrest.serialization.Model): """Resource upload definition payload. - :param relative_path: Source relative path. - :type relative_path: str - :param upload_url: Upload URL. - :type upload_url: str + :ivar relative_path: Source relative path. + :vartype relative_path: str + :ivar upload_url: Upload URL. + :vartype upload_url: str """ _attribute_map = { @@ -1875,6 +2335,12 @@ def __init__( self, **kwargs ): + """ + :keyword relative_path: Source relative path. + :paramtype relative_path: str + :keyword upload_url: Upload URL. + :paramtype upload_url: str + """ super(ResourceUploadDefinition, self).__init__(**kwargs) self.relative_path = kwargs.get('relative_path', None) self.upload_url = kwargs.get('upload_url', None) @@ -1891,11 +2357,11 @@ class TrackedResource(Resource): :vartype name: str :ivar type: The type of the resource. :vartype type: str - :param location: The GEO location of the resource. - :type location: str - :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] + :ivar location: The GEO location of the resource. + :vartype location: str + :ivar tags: A set of tags. Tags of the service which is a list of key value pairs that describe + the resource. + :vartype tags: dict[str, str] """ _validation = { @@ -1916,6 +2382,13 @@ def __init__( self, **kwargs ): + """ + :keyword location: The GEO location of the resource. + :paramtype location: str + :keyword tags: A set of tags. Tags of the service which is a list of key value pairs that + describe the resource. + :paramtype tags: dict[str, str] + """ super(TrackedResource, self).__init__(**kwargs) self.location = kwargs.get('location', None) self.tags = kwargs.get('tags', None) @@ -1932,15 +2405,16 @@ class ServiceResource(TrackedResource): :vartype name: str :ivar type: The type of the resource. :vartype type: str - :param location: The GEO location of the resource. - :type location: str - :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. - :type sku: ~azure.mgmt.appplatform.v2019_05_01_preview.models.Sku + :ivar location: The GEO location of the resource. + :vartype location: str + :ivar tags: A set of tags. Tags of the service which is a list of key value pairs that describe + the resource. + :vartype tags: dict[str, str] + :ivar properties: Properties of the Service resource. + :vartype properties: + ~azure.mgmt.appplatform.v2019_05_01_preview.models.ClusterResourceProperties + :ivar sku: Sku of the Service resource. + :vartype sku: ~azure.mgmt.appplatform.v2019_05_01_preview.models.Sku """ _validation = { @@ -1963,6 +2437,18 @@ def __init__( self, **kwargs ): + """ + :keyword location: The GEO location of the resource. + :paramtype location: str + :keyword tags: A set of tags. Tags of the service which is a list of key value pairs that + describe the resource. + :paramtype tags: dict[str, str] + :keyword properties: Properties of the Service resource. + :paramtype properties: + ~azure.mgmt.appplatform.v2019_05_01_preview.models.ClusterResourceProperties + :keyword sku: Sku of the Service resource. + :paramtype sku: ~azure.mgmt.appplatform.v2019_05_01_preview.models.Sku + """ super(ServiceResource, self).__init__(**kwargs) self.properties = kwargs.get('properties', None) self.sku = kwargs.get('sku', None) @@ -1971,11 +2457,11 @@ def __init__( 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). + :ivar value: Collection of Service resources. + :vartype value: list[~azure.mgmt.appplatform.v2019_05_01_preview.models.ServiceResource] + :ivar 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 + :vartype next_link: str """ _attribute_map = { @@ -1987,6 +2473,13 @@ def __init__( self, **kwargs ): + """ + :keyword value: Collection of Service resources. + :paramtype value: list[~azure.mgmt.appplatform.v2019_05_01_preview.models.ServiceResource] + :keyword next_link: URL client should use to fetch the next page (per server side paging). + It's null for now, added for future use. + :paramtype next_link: str + """ super(ServiceResourceList, self).__init__(**kwargs) self.value = kwargs.get('value', None) self.next_link = kwargs.get('next_link', None) @@ -1995,11 +2488,11 @@ def __init__( class ServiceSpecification(msrest.serialization.Model): """Service specification payload. - :param log_specifications: Specifications of the Log for Azure Monitoring. - :type log_specifications: + :ivar log_specifications: Specifications of the Log for Azure Monitoring. + :vartype log_specifications: list[~azure.mgmt.appplatform.v2019_05_01_preview.models.LogSpecification] - :param metric_specifications: Specifications of the Metrics for Azure Monitoring. - :type metric_specifications: + :ivar metric_specifications: Specifications of the Metrics for Azure Monitoring. + :vartype metric_specifications: list[~azure.mgmt.appplatform.v2019_05_01_preview.models.MetricSpecification] """ @@ -2012,6 +2505,14 @@ def __init__( self, **kwargs ): + """ + :keyword log_specifications: Specifications of the Log for Azure Monitoring. + :paramtype log_specifications: + list[~azure.mgmt.appplatform.v2019_05_01_preview.models.LogSpecification] + :keyword metric_specifications: Specifications of the Metrics for Azure Monitoring. + :paramtype metric_specifications: + list[~azure.mgmt.appplatform.v2019_05_01_preview.models.MetricSpecification] + """ super(ServiceSpecification, self).__init__(**kwargs) self.log_specifications = kwargs.get('log_specifications', None) self.metric_specifications = kwargs.get('metric_specifications', None) @@ -2020,12 +2521,12 @@ def __init__( class Sku(msrest.serialization.Model): """Sku of Azure Spring Cloud. - :param name: Name of the Sku. - :type name: str - :param tier: Tier of the Sku. - :type tier: str - :param capacity: Current capacity of the target resource. - :type capacity: int + :ivar name: Name of the Sku. + :vartype name: str + :ivar tier: Tier of the Sku. + :vartype tier: str + :ivar capacity: Current capacity of the target resource. + :vartype capacity: int """ _attribute_map = { @@ -2038,6 +2539,14 @@ def __init__( self, **kwargs ): + """ + :keyword name: Name of the Sku. + :paramtype name: str + :keyword tier: Tier of the Sku. + :paramtype tier: str + :keyword capacity: Current capacity of the target resource. + :paramtype capacity: int + """ super(Sku, self).__init__(**kwargs) self.name = kwargs.get('name', "S0") self.tier = kwargs.get('tier', "Standard") @@ -2049,15 +2558,15 @@ class SkuCapacity(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param minimum: Required. Gets or sets the minimum. - :type minimum: int - :param maximum: Gets or sets the maximum. - :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", + :ivar minimum: Required. Gets or sets the minimum. + :vartype minimum: int + :ivar maximum: Gets or sets the maximum. + :vartype maximum: int + :ivar default: Gets or sets the default. + :vartype default: int + :ivar 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 + :vartype scale_type: str or ~azure.mgmt.appplatform.v2019_05_01_preview.models.SkuScaleType """ _validation = { @@ -2075,6 +2584,17 @@ def __init__( self, **kwargs ): + """ + :keyword minimum: Required. Gets or sets the minimum. + :paramtype minimum: int + :keyword maximum: Gets or sets the maximum. + :paramtype maximum: int + :keyword default: Gets or sets the default. + :paramtype default: int + :keyword scale_type: Gets or sets the type of the scale. Possible values include: "None", + "Manual", "Automatic". + :paramtype scale_type: str or ~azure.mgmt.appplatform.v2019_05_01_preview.models.SkuScaleType + """ super(SkuCapacity, self).__init__(**kwargs) self.minimum = kwargs['minimum'] self.maximum = kwargs.get('maximum', None) @@ -2085,15 +2605,15 @@ def __init__( 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"). + :ivar value: The raw value which could be passed to deployment CRUD operations. Possible values + include: "Java_8", "Java_11", "NetCore_31". + :vartype value: str or ~azure.mgmt.appplatform.v2019_05_01_preview.models.SupportedRuntimeValue + :ivar platform: The platform of this runtime version (possible values: "Java" or ".NET"). Possible values include: "Java", ".NET Core". - :type platform: str or + :vartype platform: str or ~azure.mgmt.appplatform.v2019_05_01_preview.models.SupportedRuntimePlatform - :param version: The detailed version (major.minor) of the platform. - :type version: str + :ivar version: The detailed version (major.minor) of the platform. + :vartype version: str """ _attribute_map = { @@ -2106,6 +2626,18 @@ def __init__( self, **kwargs ): + """ + :keyword value: The raw value which could be passed to deployment CRUD operations. Possible + values include: "Java_8", "Java_11", "NetCore_31". + :paramtype value: str or + ~azure.mgmt.appplatform.v2019_05_01_preview.models.SupportedRuntimeValue + :keyword platform: The platform of this runtime version (possible values: "Java" or ".NET"). + Possible values include: "Java", ".NET Core". + :paramtype platform: str or + ~azure.mgmt.appplatform.v2019_05_01_preview.models.SupportedRuntimePlatform + :keyword version: The detailed version (major.minor) of the platform. + :paramtype version: str + """ super(SupportedRuntimeVersion, self).__init__(**kwargs) self.value = kwargs.get('value', None) self.platform = kwargs.get('platform', None) @@ -2115,10 +2647,10 @@ def __init__( class TemporaryDisk(msrest.serialization.Model): """Temporary disk payload. - :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. - :type mount_path: str + :ivar size_in_gb: Size of the temporary disk in GB. + :vartype size_in_gb: int + :ivar mount_path: Mount path of the temporary disk. + :vartype mount_path: str """ _validation = { @@ -2134,6 +2666,12 @@ def __init__( self, **kwargs ): + """ + :keyword size_in_gb: Size of the temporary disk in GB. + :paramtype size_in_gb: int + :keyword mount_path: Mount path of the temporary disk. + :paramtype mount_path: str + """ super(TemporaryDisk, self).__init__(**kwargs) self.size_in_gb = kwargs.get('size_in_gb', None) self.mount_path = kwargs.get('mount_path', "/tmp") @@ -2142,16 +2680,16 @@ def __init__( class TestKeys(msrest.serialization.Model): """Test keys payload. - :param primary_key: Primary key. - :type primary_key: str - :param secondary_key: Secondary key. - :type secondary_key: str - :param primary_test_endpoint: Primary test endpoint. - :type primary_test_endpoint: str - :param secondary_test_endpoint: Secondary test endpoint. - :type secondary_test_endpoint: str - :param enabled: Indicates whether the test endpoint feature enabled or not. - :type enabled: bool + :ivar primary_key: Primary key. + :vartype primary_key: str + :ivar secondary_key: Secondary key. + :vartype secondary_key: str + :ivar primary_test_endpoint: Primary test endpoint. + :vartype primary_test_endpoint: str + :ivar secondary_test_endpoint: Secondary test endpoint. + :vartype secondary_test_endpoint: str + :ivar enabled: Indicates whether the test endpoint feature enabled or not. + :vartype enabled: bool """ _attribute_map = { @@ -2166,6 +2704,18 @@ def __init__( self, **kwargs ): + """ + :keyword primary_key: Primary key. + :paramtype primary_key: str + :keyword secondary_key: Secondary key. + :paramtype secondary_key: str + :keyword primary_test_endpoint: Primary test endpoint. + :paramtype primary_test_endpoint: str + :keyword secondary_test_endpoint: Secondary test endpoint. + :paramtype secondary_test_endpoint: str + :keyword enabled: Indicates whether the test endpoint feature enabled or not. + :paramtype enabled: bool + """ super(TestKeys, self).__init__(**kwargs) self.primary_key = kwargs.get('primary_key', None) self.secondary_key = kwargs.get('secondary_key', None) @@ -2182,12 +2732,12 @@ class TraceProperties(msrest.serialization.Model): :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. - :type enabled: bool - :param app_insight_instrumentation_key: Target application insight instrumentation key. - :type app_insight_instrumentation_key: str + :ivar error: Error when apply trace proxy changes. + :vartype error: ~azure.mgmt.appplatform.v2019_05_01_preview.models.Error + :ivar enabled: Indicates whether enable the tracing functionality. + :vartype enabled: bool + :ivar app_insight_instrumentation_key: Target application insight instrumentation key. + :vartype app_insight_instrumentation_key: str """ _validation = { @@ -2205,6 +2755,14 @@ def __init__( self, **kwargs ): + """ + :keyword error: Error when apply trace proxy changes. + :paramtype error: ~azure.mgmt.appplatform.v2019_05_01_preview.models.Error + :keyword enabled: Indicates whether enable the tracing functionality. + :paramtype enabled: bool + :keyword app_insight_instrumentation_key: Target application insight instrumentation key. + :paramtype app_insight_instrumentation_key: str + """ super(TraceProperties, self).__init__(**kwargs) self.state = None self.error = kwargs.get('error', None) @@ -2215,17 +2773,17 @@ def __init__( class UserSourceInfo(msrest.serialization.Model): """Source information for a deployment. - :param type: Type of the source uploaded. Possible values include: "Jar", "NetCoreZip", + :ivar 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. - :type version: str - :param artifact_selector: Selector for the artifact to be used for the deployment for + :vartype type: str or ~azure.mgmt.appplatform.v2019_05_01_preview.models.UserSourceType + :ivar relative_path: Relative path of the storage which stores the source. + :vartype relative_path: str + :ivar version: Version of the source. + :vartype version: str + :ivar 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 + :vartype artifact_selector: str """ _attribute_map = { @@ -2239,6 +2797,19 @@ def __init__( self, **kwargs ): + """ + :keyword type: Type of the source uploaded. Possible values include: "Jar", "NetCoreZip", + "Source". + :paramtype type: str or ~azure.mgmt.appplatform.v2019_05_01_preview.models.UserSourceType + :keyword relative_path: Relative path of the storage which stores the source. + :paramtype relative_path: str + :keyword version: Version of the source. + :paramtype version: str + :keyword 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. + :paramtype artifact_selector: str + """ super(UserSourceInfo, self).__init__(**kwargs) self.type = kwargs.get('type', None) self.relative_path = kwargs.get('relative_path', None) diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2019_05_01_preview/models/_models_py3.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2019_05_01_preview/models/_models_py3.py index 2538ba5505b8a..50e62e72ced17 100644 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2019_05_01_preview/models/_models_py3.py +++ b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2019_05_01_preview/models/_models_py3.py @@ -42,6 +42,8 @@ def __init__( self, **kwargs ): + """ + """ super(Resource, self).__init__(**kwargs) self.id = None self.name = None @@ -77,6 +79,8 @@ def __init__( self, **kwargs ): + """ + """ super(ProxyResource, self).__init__(**kwargs) @@ -91,12 +95,12 @@ 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. - :type location: str + :ivar properties: Properties of the App resource. + :vartype properties: ~azure.mgmt.appplatform.v2019_05_01_preview.models.AppResourceProperties + :ivar identity: The Managed Identity type of the app resource. + :vartype identity: ~azure.mgmt.appplatform.v2019_05_01_preview.models.ManagedIdentityProperties + :ivar location: The GEO location of the application, always the same with its parent resource. + :vartype location: str """ _validation = { @@ -122,6 +126,16 @@ def __init__( location: Optional[str] = None, **kwargs ): + """ + :keyword properties: Properties of the App resource. + :paramtype properties: ~azure.mgmt.appplatform.v2019_05_01_preview.models.AppResourceProperties + :keyword identity: The Managed Identity type of the app resource. + :paramtype identity: + ~azure.mgmt.appplatform.v2019_05_01_preview.models.ManagedIdentityProperties + :keyword location: The GEO location of the application, always the same with its parent + resource. + :paramtype location: str + """ super(AppResource, self).__init__(**kwargs) self.properties = properties self.identity = identity @@ -131,11 +145,11 @@ def __init__( 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). + :ivar value: Collection of App resources. + :vartype value: list[~azure.mgmt.appplatform.v2019_05_01_preview.models.AppResource] + :ivar 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 + :vartype next_link: str """ _attribute_map = { @@ -150,6 +164,13 @@ def __init__( next_link: Optional[str] = None, **kwargs ): + """ + :keyword value: Collection of App resources. + :paramtype value: list[~azure.mgmt.appplatform.v2019_05_01_preview.models.AppResource] + :keyword next_link: URL client should use to fetch the next page (per server side paging). + It's null for now, added for future use. + :paramtype next_link: str + """ super(AppResourceCollection, self).__init__(**kwargs) self.value = value self.next_link = next_link @@ -160,26 +181,26 @@ class AppResourceProperties(msrest.serialization.Model): Variables are only populated by the server, and will be ignored when sending a request. - :param public: Indicates whether the App exposes public endpoint. - :type public: bool + :ivar public: Indicates whether the App exposes public endpoint. + :vartype public: bool :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". :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. - :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 active_deployment_name: Name of the active deployment of the App. + :vartype active_deployment_name: str + :ivar fqdn: Fully qualified dns Name. + :vartype fqdn: str + :ivar https_only: Indicate if only https is allowed. + :vartype https_only: bool :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 + :ivar temporary_disk: Temporary disk settings. + :vartype temporary_disk: ~azure.mgmt.appplatform.v2019_05_01_preview.models.TemporaryDisk + :ivar persistent_disk: Persistent disk settings. + :vartype persistent_disk: ~azure.mgmt.appplatform.v2019_05_01_preview.models.PersistentDisk """ _validation = { @@ -211,6 +232,20 @@ def __init__( persistent_disk: Optional["PersistentDisk"] = None, **kwargs ): + """ + :keyword public: Indicates whether the App exposes public endpoint. + :paramtype public: bool + :keyword active_deployment_name: Name of the active deployment of the App. + :paramtype active_deployment_name: str + :keyword fqdn: Fully qualified dns Name. + :paramtype fqdn: str + :keyword https_only: Indicate if only https is allowed. + :paramtype https_only: bool + :keyword temporary_disk: Temporary disk settings. + :paramtype temporary_disk: ~azure.mgmt.appplatform.v2019_05_01_preview.models.TemporaryDisk + :keyword persistent_disk: Persistent disk settings. + :paramtype persistent_disk: ~azure.mgmt.appplatform.v2019_05_01_preview.models.PersistentDisk + """ super(AppResourceProperties, self).__init__(**kwargs) self.public = public self.url = None @@ -226,11 +261,11 @@ def __init__( 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). + :ivar value: Collection of available operation details. + :vartype value: list[~azure.mgmt.appplatform.v2019_05_01_preview.models.OperationDetail] + :ivar 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 + :vartype next_link: str """ _attribute_map = { @@ -245,6 +280,13 @@ def __init__( next_link: Optional[str] = None, **kwargs ): + """ + :keyword value: Collection of available operation details. + :paramtype value: list[~azure.mgmt.appplatform.v2019_05_01_preview.models.OperationDetail] + :keyword next_link: URL client should use to fetch the next page (per server side paging). + It's null for now, added for future use. + :paramtype next_link: str + """ super(AvailableOperations, self).__init__(**kwargs) self.value = value self.next_link = next_link @@ -272,6 +314,8 @@ def __init__( self, **kwargs ): + """ + """ super(AvailableRuntimeVersions, self).__init__(**kwargs) self.value = None @@ -287,8 +331,9 @@ 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 + :ivar properties: Properties of the Binding resource. + :vartype properties: + ~azure.mgmt.appplatform.v2019_05_01_preview.models.BindingResourceProperties """ _validation = { @@ -310,6 +355,11 @@ def __init__( properties: Optional["BindingResourceProperties"] = None, **kwargs ): + """ + :keyword properties: Properties of the Binding resource. + :paramtype properties: + ~azure.mgmt.appplatform.v2019_05_01_preview.models.BindingResourceProperties + """ super(BindingResource, self).__init__(**kwargs) self.properties = properties @@ -317,11 +367,11 @@ def __init__( 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). + :ivar value: Collection of Binding resources. + :vartype value: list[~azure.mgmt.appplatform.v2019_05_01_preview.models.BindingResource] + :ivar 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 + :vartype next_link: str """ _attribute_map = { @@ -336,6 +386,13 @@ def __init__( next_link: Optional[str] = None, **kwargs ): + """ + :keyword value: Collection of Binding resources. + :paramtype value: list[~azure.mgmt.appplatform.v2019_05_01_preview.models.BindingResource] + :keyword next_link: URL client should use to fetch the next page (per server side paging). + It's null for now, added for future use. + :paramtype next_link: str + """ super(BindingResourceCollection, self).__init__(**kwargs) self.value = value self.next_link = next_link @@ -350,12 +407,12 @@ class BindingResourceProperties(msrest.serialization.Model): :vartype resource_name: str :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. - :type resource_id: str - :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, any] + :ivar resource_id: The Azure resource id of the bound resource. + :vartype resource_id: str + :ivar key: The key of the bound resource. + :vartype key: str + :ivar binding_parameters: Binding parameters of the Binding resource. + :vartype 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 @@ -392,6 +449,14 @@ def __init__( binding_parameters: Optional[Dict[str, Any]] = None, **kwargs ): + """ + :keyword resource_id: The Azure resource id of the bound resource. + :paramtype resource_id: str + :keyword key: The key of the bound resource. + :paramtype key: str + :keyword binding_parameters: Binding parameters of the Binding resource. + :paramtype binding_parameters: dict[str, any] + """ super(BindingResourceProperties, self).__init__(**kwargs) self.resource_name = None self.resource_type = None @@ -412,12 +477,12 @@ class CertificateProperties(msrest.serialization.Model): :ivar thumbprint: The thumbprint of certificate. :vartype thumbprint: str - :param vault_uri: Required. The vault uri of user key vault. - :type vault_uri: str - :param key_vault_cert_name: Required. The certificate name of key vault. - :type key_vault_cert_name: str - :param cert_version: The certificate version of key vault. - :type cert_version: str + :ivar vault_uri: Required. The vault uri of user key vault. + :vartype vault_uri: str + :ivar key_vault_cert_name: Required. The certificate name of key vault. + :vartype key_vault_cert_name: str + :ivar cert_version: The certificate version of key vault. + :vartype cert_version: str :ivar issuer: The issuer of certificate. :vartype issuer: str :ivar issued_date: The issue date of certificate. @@ -465,6 +530,14 @@ def __init__( cert_version: Optional[str] = None, **kwargs ): + """ + :keyword vault_uri: Required. The vault uri of user key vault. + :paramtype vault_uri: str + :keyword key_vault_cert_name: Required. The certificate name of key vault. + :paramtype key_vault_cert_name: str + :keyword cert_version: The certificate version of key vault. + :paramtype cert_version: str + """ super(CertificateProperties, self).__init__(**kwargs) self.thumbprint = None self.vault_uri = vault_uri @@ -489,8 +562,8 @@ class CertificateResource(ProxyResource): :vartype name: str :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 + :ivar properties: Properties of the certificate resource payload. + :vartype properties: ~azure.mgmt.appplatform.v2019_05_01_preview.models.CertificateProperties """ _validation = { @@ -512,6 +585,10 @@ def __init__( properties: Optional["CertificateProperties"] = None, **kwargs ): + """ + :keyword properties: Properties of the certificate resource payload. + :paramtype properties: ~azure.mgmt.appplatform.v2019_05_01_preview.models.CertificateProperties + """ super(CertificateResource, self).__init__(**kwargs) self.properties = properties @@ -519,10 +596,10 @@ def __init__( class CertificateResourceCollection(msrest.serialization.Model): """Collection compose of certificate resources list and a possible link for next page. - :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 + :ivar value: The certificate resources list. + :vartype value: list[~azure.mgmt.appplatform.v2019_05_01_preview.models.CertificateResource] + :ivar next_link: The link to next page of certificate list. + :vartype next_link: str """ _attribute_map = { @@ -537,6 +614,12 @@ def __init__( next_link: Optional[str] = None, **kwargs ): + """ + :keyword value: The certificate resources list. + :paramtype value: list[~azure.mgmt.appplatform.v2019_05_01_preview.models.CertificateResource] + :keyword next_link: The link to next page of certificate list. + :paramtype next_link: str + """ super(CertificateResourceCollection, self).__init__(**kwargs) self.value = value self.next_link = next_link @@ -545,17 +628,17 @@ def __init__( 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 + :ivar 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 + :vartype code: str + :ivar 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 + :vartype message: str + :ivar 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] + :vartype target: str + :ivar details: A list of additional details about the error. + :vartype details: list[~azure.mgmt.appplatform.v2019_05_01_preview.models.CloudErrorBody] """ _attribute_map = { @@ -574,6 +657,19 @@ def __init__( details: Optional[List["CloudErrorBody"]] = None, **kwargs ): + """ + :keyword code: An identifier for the error. Codes are invariant and are intended to be consumed + programmatically. + :paramtype code: str + :keyword message: A message describing the error, intended to be suitable for display in a user + interface. + :paramtype message: str + :keyword target: The target of the particular error. For example, the name of the property in + error. + :paramtype target: str + :keyword details: A list of additional details about the error. + :paramtype details: list[~azure.mgmt.appplatform.v2019_05_01_preview.models.CloudErrorBody] + """ super(CloudErrorBody, self).__init__(**kwargs) self.code = code self.message = message @@ -591,13 +687,13 @@ class ClusterResourceProperties(msrest.serialization.Model): "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. - :type config_server_properties: + :ivar config_server_properties: Config server git properties of the Service. + :vartype 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 trace: Trace properties of the Service. + :vartype trace: ~azure.mgmt.appplatform.v2019_05_01_preview.models.TraceProperties + :ivar network_profile: Network profile of the Service. + :vartype 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. @@ -627,6 +723,15 @@ def __init__( network_profile: Optional["NetworkProfile"] = None, **kwargs ): + """ + :keyword config_server_properties: Config server git properties of the Service. + :paramtype config_server_properties: + ~azure.mgmt.appplatform.v2019_05_01_preview.models.ConfigServerProperties + :keyword trace: Trace properties of the Service. + :paramtype trace: ~azure.mgmt.appplatform.v2019_05_01_preview.models.TraceProperties + :keyword network_profile: Network profile of the Service. + :paramtype network_profile: ~azure.mgmt.appplatform.v2019_05_01_preview.models.NetworkProfile + """ super(ClusterResourceProperties, self).__init__(**kwargs) self.provisioning_state = None self.config_server_properties = config_server_properties @@ -641,27 +746,27 @@ class ConfigServerGitProperty(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param repositories: Repositories of git. - :type repositories: + :ivar repositories: Repositories of git. + :vartype repositories: list[~azure.mgmt.appplatform.v2019_05_01_preview.models.GitPatternRepository] - :param uri: Required. URI of the repository. - :type uri: str - :param label: Label of the repository. - :type label: str - :param search_paths: Searching path of the repository. - :type search_paths: list[str] - :param username: Username of git repository basic auth. - :type username: str - :param password: Password of git repository basic auth. - :type password: str - :param host_key: Public sshKey of git repository. - :type host_key: str - :param host_key_algorithm: SshKey algorithm of git repository. - :type host_key_algorithm: str - :param private_key: Private sshKey algorithm of git repository. - :type private_key: str - :param strict_host_key_checking: Strict host key checking or not. - :type strict_host_key_checking: bool + :ivar uri: Required. URI of the repository. + :vartype uri: str + :ivar label: Label of the repository. + :vartype label: str + :ivar search_paths: Searching path of the repository. + :vartype search_paths: list[str] + :ivar username: Username of git repository basic auth. + :vartype username: str + :ivar password: Password of git repository basic auth. + :vartype password: str + :ivar host_key: Public sshKey of git repository. + :vartype host_key: str + :ivar host_key_algorithm: SshKey algorithm of git repository. + :vartype host_key_algorithm: str + :ivar private_key: Private sshKey algorithm of git repository. + :vartype private_key: str + :ivar strict_host_key_checking: Strict host key checking or not. + :vartype strict_host_key_checking: bool """ _validation = { @@ -696,6 +801,29 @@ def __init__( strict_host_key_checking: Optional[bool] = None, **kwargs ): + """ + :keyword repositories: Repositories of git. + :paramtype repositories: + list[~azure.mgmt.appplatform.v2019_05_01_preview.models.GitPatternRepository] + :keyword uri: Required. URI of the repository. + :paramtype uri: str + :keyword label: Label of the repository. + :paramtype label: str + :keyword search_paths: Searching path of the repository. + :paramtype search_paths: list[str] + :keyword username: Username of git repository basic auth. + :paramtype username: str + :keyword password: Password of git repository basic auth. + :paramtype password: str + :keyword host_key: Public sshKey of git repository. + :paramtype host_key: str + :keyword host_key_algorithm: SshKey algorithm of git repository. + :paramtype host_key_algorithm: str + :keyword private_key: Private sshKey algorithm of git repository. + :paramtype private_key: str + :keyword strict_host_key_checking: Strict host key checking or not. + :paramtype strict_host_key_checking: bool + """ super(ConfigServerGitProperty, self).__init__(**kwargs) self.repositories = repositories self.uri = uri @@ -717,10 +845,10 @@ class ConfigServerProperties(msrest.serialization.Model): :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 + :ivar error: Error when apply config server settings. + :vartype error: ~azure.mgmt.appplatform.v2019_05_01_preview.models.Error + :ivar config_server: Settings of config server. + :vartype config_server: ~azure.mgmt.appplatform.v2019_05_01_preview.models.ConfigServerSettings """ _validation = { @@ -740,6 +868,13 @@ def __init__( config_server: Optional["ConfigServerSettings"] = None, **kwargs ): + """ + :keyword error: Error when apply config server settings. + :paramtype error: ~azure.mgmt.appplatform.v2019_05_01_preview.models.Error + :keyword config_server: Settings of config server. + :paramtype config_server: + ~azure.mgmt.appplatform.v2019_05_01_preview.models.ConfigServerSettings + """ super(ConfigServerProperties, self).__init__(**kwargs) self.state = None self.error = error @@ -749,8 +884,9 @@ def __init__( 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 + :ivar git_property: Property of git environment. + :vartype git_property: + ~azure.mgmt.appplatform.v2019_05_01_preview.models.ConfigServerGitProperty """ _attribute_map = { @@ -763,6 +899,11 @@ def __init__( git_property: Optional["ConfigServerGitProperty"] = None, **kwargs ): + """ + :keyword git_property: Property of git environment. + :paramtype git_property: + ~azure.mgmt.appplatform.v2019_05_01_preview.models.ConfigServerGitProperty + """ super(ConfigServerSettings, self).__init__(**kwargs) self.git_property = git_property @@ -772,12 +913,12 @@ class CustomDomainProperties(msrest.serialization.Model): 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 + :ivar thumbprint: The thumbprint of bound certificate. + :vartype thumbprint: str :ivar app_name: The app name of domain. :vartype app_name: str - :param cert_name: The bound certificate name of domain. - :type cert_name: str + :ivar cert_name: The bound certificate name of domain. + :vartype cert_name: str """ _validation = { @@ -797,6 +938,12 @@ def __init__( cert_name: Optional[str] = None, **kwargs ): + """ + :keyword thumbprint: The thumbprint of bound certificate. + :paramtype thumbprint: str + :keyword cert_name: The bound certificate name of domain. + :paramtype cert_name: str + """ super(CustomDomainProperties, self).__init__(**kwargs) self.thumbprint = thumbprint self.app_name = None @@ -814,8 +961,8 @@ class CustomDomainResource(ProxyResource): :vartype name: str :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 + :ivar properties: Properties of the custom domain resource. + :vartype properties: ~azure.mgmt.appplatform.v2019_05_01_preview.models.CustomDomainProperties """ _validation = { @@ -837,6 +984,11 @@ def __init__( properties: Optional["CustomDomainProperties"] = None, **kwargs ): + """ + :keyword properties: Properties of the custom domain resource. + :paramtype properties: + ~azure.mgmt.appplatform.v2019_05_01_preview.models.CustomDomainProperties + """ super(CustomDomainResource, self).__init__(**kwargs) self.properties = properties @@ -844,10 +996,10 @@ def __init__( 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 + :ivar value: The custom domain resources list. + :vartype value: list[~azure.mgmt.appplatform.v2019_05_01_preview.models.CustomDomainResource] + :ivar next_link: The link to next page of custom domain list. + :vartype next_link: str """ _attribute_map = { @@ -862,6 +1014,12 @@ def __init__( next_link: Optional[str] = None, **kwargs ): + """ + :keyword value: The custom domain resources list. + :paramtype value: list[~azure.mgmt.appplatform.v2019_05_01_preview.models.CustomDomainResource] + :keyword next_link: The link to next page of custom domain list. + :paramtype next_link: str + """ super(CustomDomainResourceCollection, self).__init__(**kwargs) self.value = value self.next_link = next_link @@ -872,8 +1030,8 @@ class CustomDomainValidatePayload(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param name: Required. Name to be validated. - :type name: str + :ivar name: Required. Name to be validated. + :vartype name: str """ _validation = { @@ -890,6 +1048,10 @@ def __init__( name: str, **kwargs ): + """ + :keyword name: Required. Name to be validated. + :paramtype name: str + """ super(CustomDomainValidatePayload, self).__init__(**kwargs) self.name = name @@ -897,10 +1059,10 @@ def __init__( class CustomDomainValidateResult(msrest.serialization.Model): """Validation result for custom domain. - :param is_valid: Indicates if domain name is valid. - :type is_valid: bool - :param message: Message of why domain name is invalid. - :type message: str + :ivar is_valid: Indicates if domain name is valid. + :vartype is_valid: bool + :ivar message: Message of why domain name is invalid. + :vartype message: str """ _attribute_map = { @@ -915,6 +1077,12 @@ def __init__( message: Optional[str] = None, **kwargs ): + """ + :keyword is_valid: Indicates if domain name is valid. + :paramtype is_valid: bool + :keyword message: Message of why domain name is invalid. + :paramtype message: str + """ super(CustomDomainValidateResult, self).__init__(**kwargs) self.is_valid = is_valid self.message = message @@ -957,6 +1125,8 @@ def __init__( self, **kwargs ): + """ + """ super(DeploymentInstance, self).__init__(**kwargs) self.name = None self.status = None @@ -976,11 +1146,11 @@ 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: + :ivar properties: Properties of the Deployment resource. + :vartype 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 + :ivar sku: Sku of the Deployment resource. + :vartype sku: ~azure.mgmt.appplatform.v2019_05_01_preview.models.Sku """ _validation = { @@ -1004,6 +1174,13 @@ def __init__( sku: Optional["Sku"] = None, **kwargs ): + """ + :keyword properties: Properties of the Deployment resource. + :paramtype properties: + ~azure.mgmt.appplatform.v2019_05_01_preview.models.DeploymentResourceProperties + :keyword sku: Sku of the Deployment resource. + :paramtype sku: ~azure.mgmt.appplatform.v2019_05_01_preview.models.Sku + """ super(DeploymentResource, self).__init__(**kwargs) self.properties = properties self.sku = sku @@ -1012,11 +1189,11 @@ def __init__( 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). + :ivar value: Collection of Deployment resources. + :vartype value: list[~azure.mgmt.appplatform.v2019_05_01_preview.models.DeploymentResource] + :ivar 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 + :vartype next_link: str """ _attribute_map = { @@ -1031,6 +1208,13 @@ def __init__( next_link: Optional[str] = None, **kwargs ): + """ + :keyword value: Collection of Deployment resources. + :paramtype value: list[~azure.mgmt.appplatform.v2019_05_01_preview.models.DeploymentResource] + :keyword next_link: URL client should use to fetch the next page (per server side paging). + It's null for now, added for future use. + :paramtype next_link: str + """ super(DeploymentResourceCollection, self).__init__(**kwargs) self.value = value self.next_link = next_link @@ -1041,12 +1225,12 @@ class DeploymentResourceProperties(msrest.serialization.Model): 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 source: Uploaded source information of the deployment. + :vartype 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. - :type deployment_settings: + :ivar deployment_settings: Deployment settings of the Deployment. + :vartype 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". @@ -1091,6 +1275,13 @@ def __init__( deployment_settings: Optional["DeploymentSettings"] = None, **kwargs ): + """ + :keyword source: Uploaded source information of the deployment. + :paramtype source: ~azure.mgmt.appplatform.v2019_05_01_preview.models.UserSourceInfo + :keyword deployment_settings: Deployment settings of the Deployment. + :paramtype deployment_settings: + ~azure.mgmt.appplatform.v2019_05_01_preview.models.DeploymentSettings + """ super(DeploymentResourceProperties, self).__init__(**kwargs) self.source = source self.app_name = None @@ -1105,23 +1296,24 @@ def __init__( 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). - :type cpu: int - :param memory_in_gb: Required Memory size in GB, basic tier should be in range (1, 2), standard + :ivar cpu: Required CPU, basic tier should be 1, standard tier should be in range (1, 4). + :vartype cpu: int + :ivar 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. - :type jvm_options: str - :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 + :vartype memory_in_gb: int + :ivar jvm_options: JVM parameter. + :vartype jvm_options: str + :ivar net_core_main_entry_path: The path to the .NET executable relative to zip root. + :vartype net_core_main_entry_path: str + :ivar 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. - :type environment_variables: dict[str, str] - :param runtime_version: Runtime version. Possible values include: "Java_8", "Java_11", + :vartype instance_count: int + :ivar environment_variables: Collection of environment variables. + :vartype environment_variables: dict[str, str] + :ivar 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 + :vartype runtime_version: str or + ~azure.mgmt.appplatform.v2019_05_01_preview.models.RuntimeVersion """ _attribute_map = { @@ -1146,6 +1338,26 @@ def __init__( runtime_version: Optional[Union[str, "RuntimeVersion"]] = "Java_8", **kwargs ): + """ + :keyword cpu: Required CPU, basic tier should be 1, standard tier should be in range (1, 4). + :paramtype cpu: int + :keyword memory_in_gb: Required Memory size in GB, basic tier should be in range (1, 2), + standard tier should be in range (1, 8). + :paramtype memory_in_gb: int + :keyword jvm_options: JVM parameter. + :paramtype jvm_options: str + :keyword net_core_main_entry_path: The path to the .NET executable relative to zip root. + :paramtype net_core_main_entry_path: str + :keyword instance_count: Instance count, basic tier should be in range (1, 25), standard tier + should be in range (1, 500). + :paramtype instance_count: int + :keyword environment_variables: Collection of environment variables. + :paramtype environment_variables: dict[str, str] + :keyword runtime_version: Runtime version. Possible values include: "Java_8", "Java_11", + "NetCore_31". Default value: "Java_8". + :paramtype runtime_version: str or + ~azure.mgmt.appplatform.v2019_05_01_preview.models.RuntimeVersion + """ super(DeploymentSettings, self).__init__(**kwargs) self.cpu = cpu self.memory_in_gb = memory_in_gb @@ -1159,10 +1371,10 @@ def __init__( class Error(msrest.serialization.Model): """The error code compose of code and message. - :param code: The code of error. - :type code: str - :param message: The message of error. - :type message: str + :ivar code: The code of error. + :vartype code: str + :ivar message: The message of error. + :vartype message: str """ _attribute_map = { @@ -1177,6 +1389,12 @@ def __init__( message: Optional[str] = None, **kwargs ): + """ + :keyword code: The code of error. + :paramtype code: str + :keyword message: The message of error. + :paramtype message: str + """ super(Error, self).__init__(**kwargs) self.code = code self.message = message @@ -1187,28 +1405,28 @@ class GitPatternRepository(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param name: Required. Name of the repository. - :type name: str - :param pattern: Collection of pattern of the repository. - :type pattern: list[str] - :param uri: Required. URI of the repository. - :type uri: str - :param label: Label of the repository. - :type label: str - :param search_paths: Searching path of the repository. - :type search_paths: list[str] - :param username: Username of git repository basic auth. - :type username: str - :param password: Password of git repository basic auth. - :type password: str - :param host_key: Public sshKey of git repository. - :type host_key: str - :param host_key_algorithm: SshKey algorithm of git repository. - :type host_key_algorithm: str - :param private_key: Private sshKey algorithm of git repository. - :type private_key: str - :param strict_host_key_checking: Strict host key checking or not. - :type strict_host_key_checking: bool + :ivar name: Required. Name of the repository. + :vartype name: str + :ivar pattern: Collection of pattern of the repository. + :vartype pattern: list[str] + :ivar uri: Required. URI of the repository. + :vartype uri: str + :ivar label: Label of the repository. + :vartype label: str + :ivar search_paths: Searching path of the repository. + :vartype search_paths: list[str] + :ivar username: Username of git repository basic auth. + :vartype username: str + :ivar password: Password of git repository basic auth. + :vartype password: str + :ivar host_key: Public sshKey of git repository. + :vartype host_key: str + :ivar host_key_algorithm: SshKey algorithm of git repository. + :vartype host_key_algorithm: str + :ivar private_key: Private sshKey algorithm of git repository. + :vartype private_key: str + :ivar strict_host_key_checking: Strict host key checking or not. + :vartype strict_host_key_checking: bool """ _validation = { @@ -1246,6 +1464,30 @@ def __init__( strict_host_key_checking: Optional[bool] = None, **kwargs ): + """ + :keyword name: Required. Name of the repository. + :paramtype name: str + :keyword pattern: Collection of pattern of the repository. + :paramtype pattern: list[str] + :keyword uri: Required. URI of the repository. + :paramtype uri: str + :keyword label: Label of the repository. + :paramtype label: str + :keyword search_paths: Searching path of the repository. + :paramtype search_paths: list[str] + :keyword username: Username of git repository basic auth. + :paramtype username: str + :keyword password: Password of git repository basic auth. + :paramtype password: str + :keyword host_key: Public sshKey of git repository. + :paramtype host_key: str + :keyword host_key_algorithm: SshKey algorithm of git repository. + :paramtype host_key_algorithm: str + :keyword private_key: Private sshKey algorithm of git repository. + :paramtype private_key: str + :keyword strict_host_key_checking: Strict host key checking or not. + :paramtype strict_host_key_checking: bool + """ super(GitPatternRepository, self).__init__(**kwargs) self.name = name self.pattern = pattern @@ -1265,8 +1507,8 @@ class LogFileUrlResponse(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param url: Required. URL of the log file. - :type url: str + :ivar url: Required. URL of the log file. + :vartype url: str """ _validation = { @@ -1283,6 +1525,10 @@ def __init__( url: str, **kwargs ): + """ + :keyword url: Required. URL of the log file. + :paramtype url: str + """ super(LogFileUrlResponse, self).__init__(**kwargs) self.url = url @@ -1290,12 +1536,12 @@ def __init__( class LogSpecification(msrest.serialization.Model): """Specifications of the Log for Azure Monitoring. - :param name: Name of the log. - :type name: str - :param display_name: Localized friendly display name of the log. - :type display_name: str - :param blob_duration: Blob duration of the log. - :type blob_duration: str + :ivar name: Name of the log. + :vartype name: str + :ivar display_name: Localized friendly display name of the log. + :vartype display_name: str + :ivar blob_duration: Blob duration of the log. + :vartype blob_duration: str """ _attribute_map = { @@ -1312,6 +1558,14 @@ def __init__( blob_duration: Optional[str] = None, **kwargs ): + """ + :keyword name: Name of the log. + :paramtype name: str + :keyword display_name: Localized friendly display name of the log. + :paramtype display_name: str + :keyword blob_duration: Blob duration of the log. + :paramtype blob_duration: str + """ super(LogSpecification, self).__init__(**kwargs) self.name = name self.display_name = display_name @@ -1321,13 +1575,13 @@ def __init__( class ManagedIdentityProperties(msrest.serialization.Model): """Managed identity properties retrieved from ARM request headers. - :param type: Possible values include: "None", "SystemAssigned", "UserAssigned", + :ivar 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: - :type tenant_id: str + :vartype type: str or ~azure.mgmt.appplatform.v2019_05_01_preview.models.ManagedIdentityType + :ivar principal_id: + :vartype principal_id: str + :ivar tenant_id: + :vartype tenant_id: str """ _attribute_map = { @@ -1344,6 +1598,15 @@ def __init__( tenant_id: Optional[str] = None, **kwargs ): + """ + :keyword type: Possible values include: "None", "SystemAssigned", "UserAssigned", + "SystemAssigned,UserAssigned". + :paramtype type: str or ~azure.mgmt.appplatform.v2019_05_01_preview.models.ManagedIdentityType + :keyword principal_id: + :paramtype principal_id: str + :keyword tenant_id: + :paramtype tenant_id: str + """ super(ManagedIdentityProperties, self).__init__(**kwargs) self.type = type self.principal_id = principal_id @@ -1353,13 +1616,13 @@ def __init__( class MetricDimension(msrest.serialization.Model): """Specifications of the Dimension of metrics. - :param name: Name of the dimension. - :type name: str - :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 + :ivar name: Name of the dimension. + :vartype name: str + :ivar display_name: Localized friendly display name of the dimension. + :vartype display_name: str + :ivar to_be_exported_for_shoebox: Whether this dimension should be included for the Shoebox export scenario. - :type to_be_exported_for_shoebox: bool + :vartype to_be_exported_for_shoebox: bool """ _attribute_map = { @@ -1376,6 +1639,15 @@ def __init__( to_be_exported_for_shoebox: Optional[bool] = None, **kwargs ): + """ + :keyword name: Name of the dimension. + :paramtype name: str + :keyword display_name: Localized friendly display name of the dimension. + :paramtype display_name: str + :keyword to_be_exported_for_shoebox: Whether this dimension should be included for the Shoebox + export scenario. + :paramtype to_be_exported_for_shoebox: bool + """ super(MetricDimension, self).__init__(**kwargs) self.name = name self.display_name = display_name @@ -1385,29 +1657,31 @@ def __init__( class MetricSpecification(msrest.serialization.Model): """Specifications of the Metrics for Azure Monitoring. - :param name: Name of the metric. - :type name: str - :param display_name: Localized friendly display name of the metric. - :type display_name: str - :param display_description: Localized friendly description of the metric. - :type display_description: str - :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 + :ivar name: Name of the metric. + :vartype name: str + :ivar display_name: Localized friendly display name of the metric. + :vartype display_name: str + :ivar display_description: Localized friendly description of the metric. + :vartype display_description: str + :ivar unit: Unit that makes sense for the metric. + :vartype unit: str + :ivar 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, + :vartype category: str + :ivar 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. - :type supported_aggregation_types: list[str] - :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 + :vartype aggregation_type: str + :ivar supported_aggregation_types: Supported aggregation types. + :vartype supported_aggregation_types: list[str] + :ivar supported_time_grain_types: Supported time grain types. + :vartype supported_time_grain_types: list[str] + :ivar 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] + :vartype fill_gap_with_zero: bool + :ivar dimensions: Dimensions of the metric. + :vartype dimensions: list[~azure.mgmt.appplatform.v2019_05_01_preview.models.MetricDimension] + :ivar source_mdm_namespace: Name of the MDM namespace. Optional. + :vartype source_mdm_namespace: str """ _attribute_map = { @@ -1421,6 +1695,7 @@ class MetricSpecification(msrest.serialization.Model): 'supported_time_grain_types': {'key': 'supportedTimeGrainTypes', 'type': '[str]'}, 'fill_gap_with_zero': {'key': 'fillGapWithZero', 'type': 'bool'}, 'dimensions': {'key': 'dimensions', 'type': '[MetricDimension]'}, + 'source_mdm_namespace': {'key': 'sourceMdmNamespace', 'type': 'str'}, } def __init__( @@ -1436,8 +1711,36 @@ def __init__( supported_time_grain_types: Optional[List[str]] = None, fill_gap_with_zero: Optional[bool] = None, dimensions: Optional[List["MetricDimension"]] = None, - **kwargs - ): + source_mdm_namespace: Optional[str] = None, + **kwargs + ): + """ + :keyword name: Name of the metric. + :paramtype name: str + :keyword display_name: Localized friendly display name of the metric. + :paramtype display_name: str + :keyword display_description: Localized friendly description of the metric. + :paramtype display_description: str + :keyword unit: Unit that makes sense for the metric. + :paramtype unit: str + :keyword category: Name of the metric category that the metric belongs to. A metric can only + belong to a single category. + :paramtype category: str + :keyword aggregation_type: Only provide one value for this field. Valid values: Average, + Minimum, Maximum, Total, Count. + :paramtype aggregation_type: str + :keyword supported_aggregation_types: Supported aggregation types. + :paramtype supported_aggregation_types: list[str] + :keyword supported_time_grain_types: Supported time grain types. + :paramtype supported_time_grain_types: list[str] + :keyword fill_gap_with_zero: Optional. If set to true, then zero will be returned for time + duration where no metric is emitted/published. + :paramtype fill_gap_with_zero: bool + :keyword dimensions: Dimensions of the metric. + :paramtype dimensions: list[~azure.mgmt.appplatform.v2019_05_01_preview.models.MetricDimension] + :keyword source_mdm_namespace: Name of the MDM namespace. Optional. + :paramtype source_mdm_namespace: str + """ super(MetricSpecification, self).__init__(**kwargs) self.name = name self.display_name = display_name @@ -1449,17 +1752,18 @@ def __init__( self.supported_time_grain_types = supported_time_grain_types self.fill_gap_with_zero = fill_gap_with_zero self.dimensions = dimensions + self.source_mdm_namespace = source_mdm_namespace class NameAvailability(msrest.serialization.Model): """Name availability result payload. - :param name_available: Indicates whether the name is available. - :type name_available: bool - :param reason: Reason why the name is not available. - :type reason: str - :param message: Message why the name is not available. - :type message: str + :ivar name_available: Indicates whether the name is available. + :vartype name_available: bool + :ivar reason: Reason why the name is not available. + :vartype reason: str + :ivar message: Message why the name is not available. + :vartype message: str """ _attribute_map = { @@ -1476,6 +1780,14 @@ def __init__( message: Optional[str] = None, **kwargs ): + """ + :keyword name_available: Indicates whether the name is available. + :paramtype name_available: bool + :keyword reason: Reason why the name is not available. + :paramtype reason: str + :keyword message: Message why the name is not available. + :paramtype message: str + """ super(NameAvailability, self).__init__(**kwargs) self.name_available = name_available self.reason = reason @@ -1487,10 +1799,10 @@ class NameAvailabilityParameters(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param type: Required. Type of the resource to check name availability. - :type type: str - :param name: Required. Name to be checked. - :type name: str + :ivar type: Required. Type of the resource to check name availability. + :vartype type: str + :ivar name: Required. Name to be checked. + :vartype name: str """ _validation = { @@ -1510,6 +1822,12 @@ def __init__( name: str, **kwargs ): + """ + :keyword type: Required. Type of the resource to check name availability. + :paramtype type: str + :keyword name: Required. Name to be checked. + :paramtype name: str + """ super(NameAvailabilityParameters, self).__init__(**kwargs) self.type = type self.name = name @@ -1520,20 +1838,19 @@ class NetworkProfile(msrest.serialization.Model): 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. - :type service_runtime_subnet_id: str - :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. - :type service_cidr: str - :param service_runtime_network_resource_group: Name of the resource group containing network + :ivar service_runtime_subnet_id: Fully qualified resource Id of the subnet to host Azure Spring + Cloud Service Runtime. + :vartype service_runtime_subnet_id: str + :ivar app_subnet_id: Fully qualified resource Id of the subnet to host Azure Spring Cloud Apps. + :vartype app_subnet_id: str + :ivar service_cidr: Azure Spring Cloud service reserved CIDR. + :vartype service_cidr: str + :ivar 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 + :vartype service_runtime_network_resource_group: str + :ivar app_network_resource_group: Name of the resource group containing network resources of Azure Spring Cloud Apps. - :type app_network_resource_group: str + :vartype app_network_resource_group: str :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 @@ -1567,6 +1884,22 @@ def __init__( app_network_resource_group: Optional[str] = None, **kwargs ): + """ + :keyword service_runtime_subnet_id: Fully qualified resource Id of the subnet to host Azure + Spring Cloud Service Runtime. + :paramtype service_runtime_subnet_id: str + :keyword app_subnet_id: Fully qualified resource Id of the subnet to host Azure Spring Cloud + Apps. + :paramtype app_subnet_id: str + :keyword service_cidr: Azure Spring Cloud service reserved CIDR. + :paramtype service_cidr: str + :keyword service_runtime_network_resource_group: Name of the resource group containing network + resources of Azure Spring Cloud Service Runtime. + :paramtype service_runtime_network_resource_group: str + :keyword app_network_resource_group: Name of the resource group containing network resources of + Azure Spring Cloud Apps. + :paramtype app_network_resource_group: str + """ super(NetworkProfile, self).__init__(**kwargs) self.service_runtime_subnet_id = service_runtime_subnet_id self.app_subnet_id = app_subnet_id @@ -1598,6 +1931,8 @@ def __init__( self, **kwargs ): + """ + """ super(NetworkProfileOutboundIPs, self).__init__(**kwargs) self.public_i_ps = None @@ -1605,22 +1940,32 @@ def __init__( class OperationDetail(msrest.serialization.Model): """Operation detail payload. - :param name: Name of the operation. - :type name: str - :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. - :type origin: str - :param properties: Properties of the operation. - :type properties: ~azure.mgmt.appplatform.v2019_05_01_preview.models.OperationProperties + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar name: Name of the operation. + :vartype name: str + :ivar is_data_action: Indicates whether the operation is a data action. + :vartype is_data_action: bool + :ivar display: Display of the operation. + :vartype display: ~azure.mgmt.appplatform.v2019_05_01_preview.models.OperationDisplay + :ivar action_type: Enum. Indicates the action type. "Internal" refers to actions that are for + internal only APIs. Possible values include: "Internal". + :vartype action_type: str or ~azure.mgmt.appplatform.v2019_05_01_preview.models.ActionType + :ivar origin: Origin of the operation. + :vartype origin: str + :ivar properties: Properties of the operation. + :vartype properties: ~azure.mgmt.appplatform.v2019_05_01_preview.models.OperationProperties """ + _validation = { + 'action_type': {'readonly': True}, + } + _attribute_map = { 'name': {'key': 'name', 'type': 'str'}, 'is_data_action': {'key': 'isDataAction', 'type': 'bool'}, 'display': {'key': 'display', 'type': 'OperationDisplay'}, + 'action_type': {'key': 'actionType', 'type': 'str'}, 'origin': {'key': 'origin', 'type': 'str'}, 'properties': {'key': 'properties', 'type': 'OperationProperties'}, } @@ -1635,10 +1980,23 @@ def __init__( properties: Optional["OperationProperties"] = None, **kwargs ): + """ + :keyword name: Name of the operation. + :paramtype name: str + :keyword is_data_action: Indicates whether the operation is a data action. + :paramtype is_data_action: bool + :keyword display: Display of the operation. + :paramtype display: ~azure.mgmt.appplatform.v2019_05_01_preview.models.OperationDisplay + :keyword origin: Origin of the operation. + :paramtype origin: str + :keyword properties: Properties of the operation. + :paramtype properties: ~azure.mgmt.appplatform.v2019_05_01_preview.models.OperationProperties + """ super(OperationDetail, self).__init__(**kwargs) self.name = name self.is_data_action = is_data_action self.display = display + self.action_type = None self.origin = origin self.properties = properties @@ -1646,14 +2004,14 @@ def __init__( class OperationDisplay(msrest.serialization.Model): """Operation display payload. - :param provider: Resource provider of the operation. - :type provider: str - :param resource: Resource of the operation. - :type resource: str - :param operation: Localized friendly name for the operation. - :type operation: str - :param description: Localized friendly description for the operation. - :type description: str + :ivar provider: Resource provider of the operation. + :vartype provider: str + :ivar resource: Resource of the operation. + :vartype resource: str + :ivar operation: Localized friendly name for the operation. + :vartype operation: str + :ivar description: Localized friendly description for the operation. + :vartype description: str """ _attribute_map = { @@ -1672,6 +2030,16 @@ def __init__( description: Optional[str] = None, **kwargs ): + """ + :keyword provider: Resource provider of the operation. + :paramtype provider: str + :keyword resource: Resource of the operation. + :paramtype resource: str + :keyword operation: Localized friendly name for the operation. + :paramtype operation: str + :keyword description: Localized friendly description for the operation. + :paramtype description: str + """ super(OperationDisplay, self).__init__(**kwargs) self.provider = provider self.resource = resource @@ -1682,8 +2050,8 @@ def __init__( class OperationProperties(msrest.serialization.Model): """Extra Operation properties. - :param service_specification: Service specifications of the operation. - :type service_specification: + :ivar service_specification: Service specifications of the operation. + :vartype service_specification: ~azure.mgmt.appplatform.v2019_05_01_preview.models.ServiceSpecification """ @@ -1697,6 +2065,11 @@ def __init__( service_specification: Optional["ServiceSpecification"] = None, **kwargs ): + """ + :keyword service_specification: Service specifications of the operation. + :paramtype service_specification: + ~azure.mgmt.appplatform.v2019_05_01_preview.models.ServiceSpecification + """ super(OperationProperties, self).__init__(**kwargs) self.service_specification = service_specification @@ -1706,12 +2079,12 @@ class PersistentDisk(msrest.serialization.Model): 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. - :type size_in_gb: int + :ivar size_in_gb: Size of the persistent disk in GB. + :vartype size_in_gb: int :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. - :type mount_path: str + :ivar mount_path: Mount path of the persistent disk. + :vartype mount_path: str """ _validation = { @@ -1732,6 +2105,12 @@ def __init__( mount_path: Optional[str] = None, **kwargs ): + """ + :keyword size_in_gb: Size of the persistent disk in GB. + :paramtype size_in_gb: int + :keyword mount_path: Mount path of the persistent disk. + :paramtype mount_path: str + """ super(PersistentDisk, self).__init__(**kwargs) self.size_in_gb = size_in_gb self.used_in_gb = None @@ -1743,9 +2122,9 @@ class RegenerateTestKeyRequestPayload(msrest.serialization.Model): 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", + :ivar 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 + :vartype key_type: str or ~azure.mgmt.appplatform.v2019_05_01_preview.models.TestKeyType """ _validation = { @@ -1762,6 +2141,11 @@ def __init__( key_type: Union[str, "TestKeyType"], **kwargs ): + """ + :keyword key_type: Required. Type of the test key. Possible values include: "Primary", + "Secondary". + :paramtype key_type: str or ~azure.mgmt.appplatform.v2019_05_01_preview.models.TestKeyType + """ super(RegenerateTestKeyRequestPayload, self).__init__(**kwargs) self.key_type = key_type @@ -1804,6 +2188,8 @@ def __init__( self, **kwargs ): + """ + """ super(RequiredTraffic, self).__init__(**kwargs) self.protocol = None self.port = None @@ -1815,23 +2201,23 @@ def __init__( class ResourceSku(msrest.serialization.Model): """Describes an available Azure Spring Cloud SKU. - :param resource_type: Gets the type of resource the SKU applies to. - :type resource_type: str - :param name: Gets the name of SKU. - :type name: str - :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 - :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 + :ivar resource_type: Gets the type of resource the SKU applies to. + :vartype resource_type: str + :ivar name: Gets the name of SKU. + :vartype name: str + :ivar tier: Gets the tier of SKU. + :vartype tier: str + :ivar capacity: Gets the capacity of SKU. + :vartype capacity: ~azure.mgmt.appplatform.v2019_05_01_preview.models.SkuCapacity + :ivar locations: Gets the set of locations that the SKU is available. + :vartype locations: list[str] + :ivar location_info: Gets a list of locations and availability zones in those locations where the SKU is available. - :type location_info: + :vartype 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 + :ivar restrictions: Gets the restrictions because of which SKU cannot be used. This is empty if there are no restrictions. - :type restrictions: + :vartype restrictions: list[~azure.mgmt.appplatform.v2019_05_01_preview.models.ResourceSkuRestrictions] """ @@ -1857,6 +2243,26 @@ def __init__( restrictions: Optional[List["ResourceSkuRestrictions"]] = None, **kwargs ): + """ + :keyword resource_type: Gets the type of resource the SKU applies to. + :paramtype resource_type: str + :keyword name: Gets the name of SKU. + :paramtype name: str + :keyword tier: Gets the tier of SKU. + :paramtype tier: str + :keyword capacity: Gets the capacity of SKU. + :paramtype capacity: ~azure.mgmt.appplatform.v2019_05_01_preview.models.SkuCapacity + :keyword locations: Gets the set of locations that the SKU is available. + :paramtype locations: list[str] + :keyword location_info: Gets a list of locations and availability zones in those locations + where the SKU is available. + :paramtype location_info: + list[~azure.mgmt.appplatform.v2019_05_01_preview.models.ResourceSkuLocationInfo] + :keyword restrictions: Gets the restrictions because of which SKU cannot be used. This is + empty if there are no restrictions. + :paramtype restrictions: + list[~azure.mgmt.appplatform.v2019_05_01_preview.models.ResourceSkuRestrictions] + """ super(ResourceSku, self).__init__(**kwargs) self.resource_type = resource_type self.name = name @@ -1870,10 +2276,10 @@ def __init__( class ResourceSkuCapabilities(msrest.serialization.Model): """ResourceSkuCapabilities. - :param name: Gets an invariant to describe the feature. - :type name: str - :param value: Gets an invariant if the feature is measured by quantity. - :type value: str + :ivar name: Gets an invariant to describe the feature. + :vartype name: str + :ivar value: Gets an invariant if the feature is measured by quantity. + :vartype value: str """ _attribute_map = { @@ -1888,6 +2294,12 @@ def __init__( value: Optional[str] = None, **kwargs ): + """ + :keyword name: Gets an invariant to describe the feature. + :paramtype name: str + :keyword value: Gets an invariant if the feature is measured by quantity. + :paramtype value: str + """ super(ResourceSkuCapabilities, self).__init__(**kwargs) self.name = name self.value = value @@ -1896,11 +2308,11 @@ def __init__( 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). + :ivar value: Collection of resource SKU. + :vartype value: list[~azure.mgmt.appplatform.v2019_05_01_preview.models.ResourceSku] + :ivar 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 + :vartype next_link: str """ _attribute_map = { @@ -1915,6 +2327,13 @@ def __init__( next_link: Optional[str] = None, **kwargs ): + """ + :keyword value: Collection of resource SKU. + :paramtype value: list[~azure.mgmt.appplatform.v2019_05_01_preview.models.ResourceSku] + :keyword next_link: URL client should use to fetch the next page (per server side paging). + It's null for now, added for future use. + :paramtype next_link: str + """ super(ResourceSkuCollection, self).__init__(**kwargs) self.value = value self.next_link = next_link @@ -1923,12 +2342,12 @@ def __init__( class ResourceSkuLocationInfo(msrest.serialization.Model): """ResourceSkuLocationInfo. - :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: + :ivar location: Gets location of the SKU. + :vartype location: str + :ivar zones: Gets list of availability zones where the SKU is supported. + :vartype zones: list[str] + :ivar zone_details: Gets details of capabilities available to a SKU in specific zones. + :vartype zone_details: list[~azure.mgmt.appplatform.v2019_05_01_preview.models.ResourceSkuZoneDetails] """ @@ -1946,6 +2365,15 @@ def __init__( zone_details: Optional[List["ResourceSkuZoneDetails"]] = None, **kwargs ): + """ + :keyword location: Gets location of the SKU. + :paramtype location: str + :keyword zones: Gets list of availability zones where the SKU is supported. + :paramtype zones: list[str] + :keyword zone_details: Gets details of capabilities available to a SKU in specific zones. + :paramtype zone_details: + list[~azure.mgmt.appplatform.v2019_05_01_preview.models.ResourceSkuZoneDetails] + """ super(ResourceSkuLocationInfo, self).__init__(**kwargs) self.location = location self.zones = zones @@ -1955,10 +2383,10 @@ def __init__( class ResourceSkuRestrictionInfo(msrest.serialization.Model): """ResourceSkuRestrictionInfo. - :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] + :ivar locations: Gets locations where the SKU is restricted. + :vartype locations: list[str] + :ivar zones: Gets list of availability zones where the SKU is restricted. + :vartype zones: list[str] """ _attribute_map = { @@ -1973,6 +2401,12 @@ def __init__( zones: Optional[List[str]] = None, **kwargs ): + """ + :keyword locations: Gets locations where the SKU is restricted. + :paramtype locations: list[str] + :keyword zones: Gets list of availability zones where the SKU is restricted. + :paramtype zones: list[str] + """ super(ResourceSkuRestrictionInfo, self).__init__(**kwargs) self.locations = locations self.zones = zones @@ -1981,21 +2415,21 @@ def __init__( class ResourceSkuRestrictions(msrest.serialization.Model): """ResourceSkuRestrictions. - :param type: Gets the type of restrictions. Possible values include: 'Location', 'Zone'. + :ivar type: Gets the type of restrictions. Possible values include: 'Location', 'Zone'. Possible values include: "Location", "Zone". - :type type: str or + :vartype 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 + :ivar 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 + :vartype values: list[str] + :ivar restriction_info: Gets the information about the restriction where the SKU cannot be used. - :type restriction_info: + :vartype restriction_info: ~azure.mgmt.appplatform.v2019_05_01_preview.models.ResourceSkuRestrictionInfo - :param reason_code: Gets the reason for restriction. Possible values include: 'QuotaId', + :ivar reason_code: Gets the reason for restriction. Possible values include: 'QuotaId', 'NotAvailableForSubscription'. Possible values include: "QuotaId", "NotAvailableForSubscription". - :type reason_code: str or + :vartype reason_code: str or ~azure.mgmt.appplatform.v2019_05_01_preview.models.ResourceSkuRestrictionsReasonCode """ @@ -2015,6 +2449,24 @@ def __init__( reason_code: Optional[Union[str, "ResourceSkuRestrictionsReasonCode"]] = None, **kwargs ): + """ + :keyword type: Gets the type of restrictions. Possible values include: 'Location', 'Zone'. + Possible values include: "Location", "Zone". + :paramtype type: str or + ~azure.mgmt.appplatform.v2019_05_01_preview.models.ResourceSkuRestrictionsType + :keyword values: Gets the value of restrictions. If the restriction type is set to + location. This would be different locations where the SKU is restricted. + :paramtype values: list[str] + :keyword restriction_info: Gets the information about the restriction where the SKU cannot be + used. + :paramtype restriction_info: + ~azure.mgmt.appplatform.v2019_05_01_preview.models.ResourceSkuRestrictionInfo + :keyword reason_code: Gets the reason for restriction. Possible values include: 'QuotaId', + 'NotAvailableForSubscription'. Possible values include: "QuotaId", + "NotAvailableForSubscription". + :paramtype reason_code: str or + ~azure.mgmt.appplatform.v2019_05_01_preview.models.ResourceSkuRestrictionsReasonCode + """ super(ResourceSkuRestrictions, self).__init__(**kwargs) self.type = type self.values = values @@ -2025,12 +2477,12 @@ def __init__( class ResourceSkuZoneDetails(msrest.serialization.Model): """ResourceSkuZoneDetails. - :param name: Gets the set of zones that the SKU is available in with the + :ivar 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 + :vartype name: list[str] + :ivar capabilities: Gets a list of capabilities that are available for the SKU in the specified list of zones. - :type capabilities: + :vartype capabilities: list[~azure.mgmt.appplatform.v2019_05_01_preview.models.ResourceSkuCapabilities] """ @@ -2046,6 +2498,15 @@ def __init__( capabilities: Optional[List["ResourceSkuCapabilities"]] = None, **kwargs ): + """ + :keyword name: Gets the set of zones that the SKU is available in with the + specified capabilities. + :paramtype name: list[str] + :keyword capabilities: Gets a list of capabilities that are available for the SKU in the + specified list of zones. + :paramtype capabilities: + list[~azure.mgmt.appplatform.v2019_05_01_preview.models.ResourceSkuCapabilities] + """ super(ResourceSkuZoneDetails, self).__init__(**kwargs) self.name = name self.capabilities = capabilities @@ -2054,10 +2515,10 @@ def __init__( class ResourceUploadDefinition(msrest.serialization.Model): """Resource upload definition payload. - :param relative_path: Source relative path. - :type relative_path: str - :param upload_url: Upload URL. - :type upload_url: str + :ivar relative_path: Source relative path. + :vartype relative_path: str + :ivar upload_url: Upload URL. + :vartype upload_url: str """ _attribute_map = { @@ -2072,6 +2533,12 @@ def __init__( upload_url: Optional[str] = None, **kwargs ): + """ + :keyword relative_path: Source relative path. + :paramtype relative_path: str + :keyword upload_url: Upload URL. + :paramtype upload_url: str + """ super(ResourceUploadDefinition, self).__init__(**kwargs) self.relative_path = relative_path self.upload_url = upload_url @@ -2088,11 +2555,11 @@ class TrackedResource(Resource): :vartype name: str :ivar type: The type of the resource. :vartype type: str - :param location: The GEO location of the resource. - :type location: str - :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] + :ivar location: The GEO location of the resource. + :vartype location: str + :ivar tags: A set of tags. Tags of the service which is a list of key value pairs that describe + the resource. + :vartype tags: dict[str, str] """ _validation = { @@ -2116,6 +2583,13 @@ def __init__( tags: Optional[Dict[str, str]] = None, **kwargs ): + """ + :keyword location: The GEO location of the resource. + :paramtype location: str + :keyword tags: A set of tags. Tags of the service which is a list of key value pairs that + describe the resource. + :paramtype tags: dict[str, str] + """ super(TrackedResource, self).__init__(**kwargs) self.location = location self.tags = tags @@ -2132,15 +2606,16 @@ class ServiceResource(TrackedResource): :vartype name: str :ivar type: The type of the resource. :vartype type: str - :param location: The GEO location of the resource. - :type location: str - :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. - :type sku: ~azure.mgmt.appplatform.v2019_05_01_preview.models.Sku + :ivar location: The GEO location of the resource. + :vartype location: str + :ivar tags: A set of tags. Tags of the service which is a list of key value pairs that describe + the resource. + :vartype tags: dict[str, str] + :ivar properties: Properties of the Service resource. + :vartype properties: + ~azure.mgmt.appplatform.v2019_05_01_preview.models.ClusterResourceProperties + :ivar sku: Sku of the Service resource. + :vartype sku: ~azure.mgmt.appplatform.v2019_05_01_preview.models.Sku """ _validation = { @@ -2168,6 +2643,18 @@ def __init__( sku: Optional["Sku"] = None, **kwargs ): + """ + :keyword location: The GEO location of the resource. + :paramtype location: str + :keyword tags: A set of tags. Tags of the service which is a list of key value pairs that + describe the resource. + :paramtype tags: dict[str, str] + :keyword properties: Properties of the Service resource. + :paramtype properties: + ~azure.mgmt.appplatform.v2019_05_01_preview.models.ClusterResourceProperties + :keyword sku: Sku of the Service resource. + :paramtype sku: ~azure.mgmt.appplatform.v2019_05_01_preview.models.Sku + """ super(ServiceResource, self).__init__(location=location, tags=tags, **kwargs) self.properties = properties self.sku = sku @@ -2176,11 +2663,11 @@ def __init__( 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). + :ivar value: Collection of Service resources. + :vartype value: list[~azure.mgmt.appplatform.v2019_05_01_preview.models.ServiceResource] + :ivar 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 + :vartype next_link: str """ _attribute_map = { @@ -2195,6 +2682,13 @@ def __init__( next_link: Optional[str] = None, **kwargs ): + """ + :keyword value: Collection of Service resources. + :paramtype value: list[~azure.mgmt.appplatform.v2019_05_01_preview.models.ServiceResource] + :keyword next_link: URL client should use to fetch the next page (per server side paging). + It's null for now, added for future use. + :paramtype next_link: str + """ super(ServiceResourceList, self).__init__(**kwargs) self.value = value self.next_link = next_link @@ -2203,11 +2697,11 @@ def __init__( class ServiceSpecification(msrest.serialization.Model): """Service specification payload. - :param log_specifications: Specifications of the Log for Azure Monitoring. - :type log_specifications: + :ivar log_specifications: Specifications of the Log for Azure Monitoring. + :vartype log_specifications: list[~azure.mgmt.appplatform.v2019_05_01_preview.models.LogSpecification] - :param metric_specifications: Specifications of the Metrics for Azure Monitoring. - :type metric_specifications: + :ivar metric_specifications: Specifications of the Metrics for Azure Monitoring. + :vartype metric_specifications: list[~azure.mgmt.appplatform.v2019_05_01_preview.models.MetricSpecification] """ @@ -2223,6 +2717,14 @@ def __init__( metric_specifications: Optional[List["MetricSpecification"]] = None, **kwargs ): + """ + :keyword log_specifications: Specifications of the Log for Azure Monitoring. + :paramtype log_specifications: + list[~azure.mgmt.appplatform.v2019_05_01_preview.models.LogSpecification] + :keyword metric_specifications: Specifications of the Metrics for Azure Monitoring. + :paramtype metric_specifications: + list[~azure.mgmt.appplatform.v2019_05_01_preview.models.MetricSpecification] + """ super(ServiceSpecification, self).__init__(**kwargs) self.log_specifications = log_specifications self.metric_specifications = metric_specifications @@ -2231,12 +2733,12 @@ def __init__( class Sku(msrest.serialization.Model): """Sku of Azure Spring Cloud. - :param name: Name of the Sku. - :type name: str - :param tier: Tier of the Sku. - :type tier: str - :param capacity: Current capacity of the target resource. - :type capacity: int + :ivar name: Name of the Sku. + :vartype name: str + :ivar tier: Tier of the Sku. + :vartype tier: str + :ivar capacity: Current capacity of the target resource. + :vartype capacity: int """ _attribute_map = { @@ -2253,6 +2755,14 @@ def __init__( capacity: Optional[int] = None, **kwargs ): + """ + :keyword name: Name of the Sku. + :paramtype name: str + :keyword tier: Tier of the Sku. + :paramtype tier: str + :keyword capacity: Current capacity of the target resource. + :paramtype capacity: int + """ super(Sku, self).__init__(**kwargs) self.name = name self.tier = tier @@ -2264,15 +2774,15 @@ class SkuCapacity(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param minimum: Required. Gets or sets the minimum. - :type minimum: int - :param maximum: Gets or sets the maximum. - :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", + :ivar minimum: Required. Gets or sets the minimum. + :vartype minimum: int + :ivar maximum: Gets or sets the maximum. + :vartype maximum: int + :ivar default: Gets or sets the default. + :vartype default: int + :ivar 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 + :vartype scale_type: str or ~azure.mgmt.appplatform.v2019_05_01_preview.models.SkuScaleType """ _validation = { @@ -2295,6 +2805,17 @@ def __init__( scale_type: Optional[Union[str, "SkuScaleType"]] = None, **kwargs ): + """ + :keyword minimum: Required. Gets or sets the minimum. + :paramtype minimum: int + :keyword maximum: Gets or sets the maximum. + :paramtype maximum: int + :keyword default: Gets or sets the default. + :paramtype default: int + :keyword scale_type: Gets or sets the type of the scale. Possible values include: "None", + "Manual", "Automatic". + :paramtype scale_type: str or ~azure.mgmt.appplatform.v2019_05_01_preview.models.SkuScaleType + """ super(SkuCapacity, self).__init__(**kwargs) self.minimum = minimum self.maximum = maximum @@ -2305,15 +2826,15 @@ def __init__( 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"). + :ivar value: The raw value which could be passed to deployment CRUD operations. Possible values + include: "Java_8", "Java_11", "NetCore_31". + :vartype value: str or ~azure.mgmt.appplatform.v2019_05_01_preview.models.SupportedRuntimeValue + :ivar platform: The platform of this runtime version (possible values: "Java" or ".NET"). Possible values include: "Java", ".NET Core". - :type platform: str or + :vartype platform: str or ~azure.mgmt.appplatform.v2019_05_01_preview.models.SupportedRuntimePlatform - :param version: The detailed version (major.minor) of the platform. - :type version: str + :ivar version: The detailed version (major.minor) of the platform. + :vartype version: str """ _attribute_map = { @@ -2330,6 +2851,18 @@ def __init__( version: Optional[str] = None, **kwargs ): + """ + :keyword value: The raw value which could be passed to deployment CRUD operations. Possible + values include: "Java_8", "Java_11", "NetCore_31". + :paramtype value: str or + ~azure.mgmt.appplatform.v2019_05_01_preview.models.SupportedRuntimeValue + :keyword platform: The platform of this runtime version (possible values: "Java" or ".NET"). + Possible values include: "Java", ".NET Core". + :paramtype platform: str or + ~azure.mgmt.appplatform.v2019_05_01_preview.models.SupportedRuntimePlatform + :keyword version: The detailed version (major.minor) of the platform. + :paramtype version: str + """ super(SupportedRuntimeVersion, self).__init__(**kwargs) self.value = value self.platform = platform @@ -2339,10 +2872,10 @@ def __init__( class TemporaryDisk(msrest.serialization.Model): """Temporary disk payload. - :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. - :type mount_path: str + :ivar size_in_gb: Size of the temporary disk in GB. + :vartype size_in_gb: int + :ivar mount_path: Mount path of the temporary disk. + :vartype mount_path: str """ _validation = { @@ -2361,6 +2894,12 @@ def __init__( mount_path: Optional[str] = "/tmp", **kwargs ): + """ + :keyword size_in_gb: Size of the temporary disk in GB. + :paramtype size_in_gb: int + :keyword mount_path: Mount path of the temporary disk. + :paramtype mount_path: str + """ super(TemporaryDisk, self).__init__(**kwargs) self.size_in_gb = size_in_gb self.mount_path = mount_path @@ -2369,16 +2908,16 @@ def __init__( class TestKeys(msrest.serialization.Model): """Test keys payload. - :param primary_key: Primary key. - :type primary_key: str - :param secondary_key: Secondary key. - :type secondary_key: str - :param primary_test_endpoint: Primary test endpoint. - :type primary_test_endpoint: str - :param secondary_test_endpoint: Secondary test endpoint. - :type secondary_test_endpoint: str - :param enabled: Indicates whether the test endpoint feature enabled or not. - :type enabled: bool + :ivar primary_key: Primary key. + :vartype primary_key: str + :ivar secondary_key: Secondary key. + :vartype secondary_key: str + :ivar primary_test_endpoint: Primary test endpoint. + :vartype primary_test_endpoint: str + :ivar secondary_test_endpoint: Secondary test endpoint. + :vartype secondary_test_endpoint: str + :ivar enabled: Indicates whether the test endpoint feature enabled or not. + :vartype enabled: bool """ _attribute_map = { @@ -2399,6 +2938,18 @@ def __init__( enabled: Optional[bool] = None, **kwargs ): + """ + :keyword primary_key: Primary key. + :paramtype primary_key: str + :keyword secondary_key: Secondary key. + :paramtype secondary_key: str + :keyword primary_test_endpoint: Primary test endpoint. + :paramtype primary_test_endpoint: str + :keyword secondary_test_endpoint: Secondary test endpoint. + :paramtype secondary_test_endpoint: str + :keyword enabled: Indicates whether the test endpoint feature enabled or not. + :paramtype enabled: bool + """ super(TestKeys, self).__init__(**kwargs) self.primary_key = primary_key self.secondary_key = secondary_key @@ -2415,12 +2966,12 @@ class TraceProperties(msrest.serialization.Model): :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. - :type enabled: bool - :param app_insight_instrumentation_key: Target application insight instrumentation key. - :type app_insight_instrumentation_key: str + :ivar error: Error when apply trace proxy changes. + :vartype error: ~azure.mgmt.appplatform.v2019_05_01_preview.models.Error + :ivar enabled: Indicates whether enable the tracing functionality. + :vartype enabled: bool + :ivar app_insight_instrumentation_key: Target application insight instrumentation key. + :vartype app_insight_instrumentation_key: str """ _validation = { @@ -2442,6 +2993,14 @@ def __init__( app_insight_instrumentation_key: Optional[str] = None, **kwargs ): + """ + :keyword error: Error when apply trace proxy changes. + :paramtype error: ~azure.mgmt.appplatform.v2019_05_01_preview.models.Error + :keyword enabled: Indicates whether enable the tracing functionality. + :paramtype enabled: bool + :keyword app_insight_instrumentation_key: Target application insight instrumentation key. + :paramtype app_insight_instrumentation_key: str + """ super(TraceProperties, self).__init__(**kwargs) self.state = None self.error = error @@ -2452,17 +3011,17 @@ def __init__( class UserSourceInfo(msrest.serialization.Model): """Source information for a deployment. - :param type: Type of the source uploaded. Possible values include: "Jar", "NetCoreZip", + :ivar 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. - :type version: str - :param artifact_selector: Selector for the artifact to be used for the deployment for + :vartype type: str or ~azure.mgmt.appplatform.v2019_05_01_preview.models.UserSourceType + :ivar relative_path: Relative path of the storage which stores the source. + :vartype relative_path: str + :ivar version: Version of the source. + :vartype version: str + :ivar 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 + :vartype artifact_selector: str """ _attribute_map = { @@ -2481,6 +3040,19 @@ def __init__( artifact_selector: Optional[str] = None, **kwargs ): + """ + :keyword type: Type of the source uploaded. Possible values include: "Jar", "NetCoreZip", + "Source". + :paramtype type: str or ~azure.mgmt.appplatform.v2019_05_01_preview.models.UserSourceType + :keyword relative_path: Relative path of the storage which stores the source. + :paramtype relative_path: str + :keyword version: Version of the source. + :paramtype version: str + :keyword 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. + :paramtype artifact_selector: str + """ super(UserSourceInfo, self).__init__(**kwargs) self.type = type self.relative_path = relative_path diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2019_05_01_preview/operations/_apps_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2019_05_01_preview/operations/_apps_operations.py index 3f791b5446735..693807a473131 100644 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2019_05_01_preview/operations/_apps_operations.py +++ b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2019_05_01_preview/operations/_apps_operations.py @@ -5,26 +5,272 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools from typing import TYPE_CHECKING import warnings 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.pipeline.transport import HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling +from msrest import Serializer from .. import models as _models +from .._vendor import _convert_request, _format_url_section 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]] +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False +# fmt: off + +def build_get_request( + subscription_id, # type: str + resource_group_name, # type: str + service_name, # type: str + app_name, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + sync_status = kwargs.pop('sync_status', None) # type: Optional[str] + + api_version = "2019-05-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), + "appName": _SERIALIZER.url("app_name", app_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + if sync_status is not None: + query_parameters['syncStatus'] = _SERIALIZER.query("sync_status", sync_status, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_create_or_update_request_initial( + subscription_id, # type: str + resource_group_name, # type: str + service_name, # type: str + app_name, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2019-05-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), + "appName": _SERIALIZER.url("app_name", app_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_delete_request( + subscription_id, # type: str + resource_group_name, # type: str + service_name, # type: str + app_name, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + api_version = "2019-05-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), + "appName": _SERIALIZER.url("app_name", app_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="DELETE", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_update_request_initial( + subscription_id, # type: str + resource_group_name, # type: str + service_name, # type: str + app_name, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2019-05-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), + "appName": _SERIALIZER.url("app_name", app_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PATCH", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_list_request( + subscription_id, # type: str + resource_group_name, # type: str + service_name, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + api_version = "2019-05-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_get_resource_upload_url_request( + subscription_id, # type: str + resource_group_name, # type: str + service_name, # type: str + app_name, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + api_version = "2019-05-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/getResourceUploadUrl') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), + "appName": _SERIALIZER.url("app_name", app_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + +# fmt: on class AppsOperations(object): """AppsOperations operations. @@ -47,6 +293,7 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def get( self, resource_group_name, # type: str @@ -77,30 +324,19 @@ def get( 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 = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + sync_status=sync_status, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -114,8 +350,10 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized + 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, # type: str @@ -130,33 +368,23 @@ def _create_or_update_initial( 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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(app_resource, 'AppResource') - # 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') + request = build_create_or_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -174,8 +402,11 @@ def _create_or_update_initial( 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 + + @distributed_trace def begin_create_or_update( self, resource_group_name, # type: str @@ -198,15 +429,20 @@ def begin_create_or_update( :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. + :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: + :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 """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.AppResource"] lro_delay = kwargs.pop( 'polling_interval', @@ -219,28 +455,21 @@ def begin_create_or_update( service_name=service_name, app_name=app_name, app_resource=app_resource, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_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 = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -252,8 +481,10 @@ def get_long_running_output(pipeline_response): ) 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 + @distributed_trace def delete( self, resource_group_name, # type: str @@ -281,28 +512,18 @@ def delete( 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 = build_delete_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + template_url=self.delete.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -315,6 +536,7 @@ def delete( delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}'} # type: ignore + def _update_initial( self, resource_group_name, # type: str @@ -329,33 +551,23 @@ def _update_initial( 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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(app_resource, 'AppResource') - # 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') + request = build_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + content_type=content_type, + json=_json, + template_url=self._update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -373,8 +585,11 @@ def _update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}'} # type: ignore + + @distributed_trace def begin_update( self, resource_group_name, # type: str @@ -397,15 +612,20 @@ def begin_update( :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. + :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: + :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 """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.AppResource"] lro_delay = kwargs.pop( 'polling_interval', @@ -418,28 +638,21 @@ def begin_update( service_name=service_name, app_name=app_name, app_resource=app_resource, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_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 = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -451,8 +664,10 @@ def get_long_running_output(pipeline_response): ) 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 + @distributed_trace def list( self, resource_group_name, # type: str @@ -468,8 +683,10 @@ def list( :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.paging.ItemPaged[~azure.mgmt.appplatform.v2019_05_01_preview.models.AppResourceCollection] + :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"] @@ -477,36 +694,33 @@ def list( 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) + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('AppResourceCollection', pipeline_response) + deserialized = self._deserialize("AppResourceCollection", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -524,11 +738,13 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps'} # type: ignore + @distributed_trace def get_resource_upload_url( self, resource_group_name, # type: str @@ -556,28 +772,18 @@ def get_resource_upload_url( 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 = build_get_resource_upload_url_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + template_url=self.get_resource_upload_url.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -591,4 +797,6 @@ def get_resource_upload_url( 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/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2019_05_01_preview/operations/_bindings_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2019_05_01_preview/operations/_bindings_operations.py index 9b46198820510..0e6ca2f7d5e21 100644 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2019_05_01_preview/operations/_bindings_operations.py +++ b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2019_05_01_preview/operations/_bindings_operations.py @@ -5,24 +5,238 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools from typing import TYPE_CHECKING import warnings 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.pipeline.transport import HttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat +from msrest import Serializer from .. import models as _models +from .._vendor import _convert_request, _format_url_section 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]] +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False +# fmt: off + +def build_get_request( + subscription_id, # type: str + resource_group_name, # type: str + service_name, # type: str + app_name, # type: str + binding_name, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + api_version = "2019-05-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/bindings/{bindingName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), + "appName": _SERIALIZER.url("app_name", app_name, 'str'), + "bindingName": _SERIALIZER.url("binding_name", binding_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_create_or_update_request( + subscription_id, # type: str + resource_group_name, # type: str + service_name, # type: str + app_name, # type: str + binding_name, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2019-05-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/bindings/{bindingName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), + "appName": _SERIALIZER.url("app_name", app_name, 'str'), + "bindingName": _SERIALIZER.url("binding_name", binding_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_delete_request( + subscription_id, # type: str + resource_group_name, # type: str + service_name, # type: str + app_name, # type: str + binding_name, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + api_version = "2019-05-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/bindings/{bindingName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), + "appName": _SERIALIZER.url("app_name", app_name, 'str'), + "bindingName": _SERIALIZER.url("binding_name", binding_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="DELETE", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_update_request( + subscription_id, # type: str + resource_group_name, # type: str + service_name, # type: str + app_name, # type: str + binding_name, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2019-05-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/bindings/{bindingName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), + "appName": _SERIALIZER.url("app_name", app_name, 'str'), + "bindingName": _SERIALIZER.url("binding_name", binding_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PATCH", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_list_request( + subscription_id, # type: str + resource_group_name, # type: str + service_name, # type: str + app_name, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + api_version = "2019-05-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/bindings') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), + "appName": _SERIALIZER.url("app_name", app_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + +# fmt: on class BindingsOperations(object): """BindingsOperations operations. @@ -45,6 +259,7 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def get( self, resource_group_name, # type: str @@ -75,29 +290,19 @@ def get( 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 = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + binding_name=binding_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -111,8 +316,11 @@ def get( 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 + + @distributed_trace def create_or_update( self, resource_group_name, # type: str @@ -146,34 +354,24 @@ def create_or_update( 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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(binding_resource, 'BindingResource') - # 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') + request = build_create_or_update_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + binding_name=binding_name, + content_type=content_type, + json=_json, + template_url=self.create_or_update.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -187,8 +385,11 @@ def create_or_update( 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 + + @distributed_trace def delete( self, resource_group_name, # type: str @@ -219,29 +420,19 @@ def delete( 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 = build_delete_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + binding_name=binding_name, + template_url=self.delete.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -254,6 +445,8 @@ def delete( delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/bindings/{bindingName}'} # type: ignore + + @distributed_trace def update( self, resource_group_name, # type: str @@ -287,34 +480,24 @@ def update( 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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(binding_resource, 'BindingResource') - # 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') + request = build_update_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + binding_name=binding_name, + content_type=content_type, + json=_json, + template_url=self.update.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -328,8 +511,11 @@ def update( 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 + + @distributed_trace def list( self, resource_group_name, # type: str @@ -348,8 +534,10 @@ def list( :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.paging.ItemPaged[~azure.mgmt.appplatform.v2019_05_01_preview.models.BindingResourceCollection] + :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"] @@ -357,37 +545,35 @@ def list( 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) + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('BindingResourceCollection', pipeline_response) + deserialized = self._deserialize("BindingResourceCollection", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -405,6 +591,7 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2019_05_01_preview/operations/_certificates_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2019_05_01_preview/operations/_certificates_operations.py index 2278aec78e3fb..92935d466956c 100644 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2019_05_01_preview/operations/_certificates_operations.py +++ b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2019_05_01_preview/operations/_certificates_operations.py @@ -5,24 +5,186 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools from typing import TYPE_CHECKING import warnings 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.pipeline.transport import HttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat +from msrest import Serializer from .. import models as _models +from .._vendor import _convert_request, _format_url_section 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]] +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False +# fmt: off + +def build_get_request( + subscription_id, # type: str + resource_group_name, # type: str + service_name, # type: str + certificate_name, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + api_version = "2019-05-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/certificates/{certificateName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), + "certificateName": _SERIALIZER.url("certificate_name", certificate_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_create_or_update_request( + subscription_id, # type: str + resource_group_name, # type: str + service_name, # type: str + certificate_name, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2019-05-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/certificates/{certificateName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), + "certificateName": _SERIALIZER.url("certificate_name", certificate_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_delete_request( + subscription_id, # type: str + resource_group_name, # type: str + service_name, # type: str + certificate_name, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + api_version = "2019-05-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/certificates/{certificateName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), + "certificateName": _SERIALIZER.url("certificate_name", certificate_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="DELETE", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_list_request( + subscription_id, # type: str + resource_group_name, # type: str + service_name, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + api_version = "2019-05-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/certificates') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + +# fmt: on class CertificatesOperations(object): """CertificatesOperations operations. @@ -45,6 +207,7 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def get( self, resource_group_name, # type: str @@ -72,28 +235,18 @@ def get( 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 = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + certificate_name=certificate_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -107,8 +260,11 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/certificates/{certificateName}'} # type: ignore + + @distributed_trace def create_or_update( self, resource_group_name, # type: str @@ -128,7 +284,8 @@ def create_or_update( :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 + :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 @@ -139,33 +296,23 @@ def create_or_update( 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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = self._serialize.body(certificate_resource, 'CertificateResource') + + request = build_create_or_update_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + certificate_name=certificate_name, + content_type=content_type, + json=_json, + template_url=self.create_or_update.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -179,8 +326,11 @@ def create_or_update( 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 + + @distributed_trace def delete( self, resource_group_name, # type: str @@ -208,28 +358,18 @@ def delete( 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 = build_delete_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + certificate_name=certificate_name, + template_url=self.delete.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -242,6 +382,8 @@ def delete( delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/certificates/{certificateName}'} # type: ignore + + @distributed_trace def list( self, resource_group_name, # type: str @@ -257,8 +399,10 @@ def list( :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.paging.ItemPaged[~azure.mgmt.appplatform.v2019_05_01_preview.models.CertificateResourceCollection] + :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"] @@ -266,36 +410,33 @@ def list( 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) + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('CertificateResourceCollection', pipeline_response) + deserialized = self._deserialize("CertificateResourceCollection", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -313,6 +454,7 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2019_05_01_preview/operations/_custom_domains_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2019_05_01_preview/operations/_custom_domains_operations.py index 9f096ceaa361c..70c877c50f498 100644 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2019_05_01_preview/operations/_custom_domains_operations.py +++ b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2019_05_01_preview/operations/_custom_domains_operations.py @@ -5,24 +5,280 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools from typing import TYPE_CHECKING import warnings 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.pipeline.transport import HttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat +from msrest import Serializer from .. import models as _models +from .._vendor import _convert_request, _format_url_section 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]] +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False +# fmt: off + +def build_get_request( + subscription_id, # type: str + resource_group_name, # type: str + service_name, # type: str + app_name, # type: str + domain_name, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + api_version = "2019-05-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/domains/{domainName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), + "appName": _SERIALIZER.url("app_name", app_name, 'str'), + "domainName": _SERIALIZER.url("domain_name", domain_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_create_or_update_request( + subscription_id, # type: str + resource_group_name, # type: str + service_name, # type: str + app_name, # type: str + domain_name, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2019-05-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/domains/{domainName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), + "appName": _SERIALIZER.url("app_name", app_name, 'str'), + "domainName": _SERIALIZER.url("domain_name", domain_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_delete_request( + subscription_id, # type: str + resource_group_name, # type: str + service_name, # type: str + app_name, # type: str + domain_name, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + api_version = "2019-05-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/domains/{domainName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), + "appName": _SERIALIZER.url("app_name", app_name, 'str'), + "domainName": _SERIALIZER.url("domain_name", domain_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="DELETE", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_patch_request( + subscription_id, # type: str + resource_group_name, # type: str + service_name, # type: str + app_name, # type: str + domain_name, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2019-05-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/domains/{domainName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), + "appName": _SERIALIZER.url("app_name", app_name, 'str'), + "domainName": _SERIALIZER.url("domain_name", domain_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PATCH", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_list_request( + subscription_id, # type: str + resource_group_name, # type: str + service_name, # type: str + app_name, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + api_version = "2019-05-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/domains') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), + "appName": _SERIALIZER.url("app_name", app_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_validate_request( + subscription_id, # type: str + resource_group_name, # type: str + service_name, # type: str + app_name, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2019-05-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/domains/validate') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), + "appName": _SERIALIZER.url("app_name", app_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + +# fmt: on class CustomDomainsOperations(object): """CustomDomainsOperations operations. @@ -45,6 +301,7 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def get( self, resource_group_name, # type: str @@ -75,29 +332,19 @@ def get( 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 = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + domain_name=domain_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -111,8 +358,11 @@ def get( 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 + + @distributed_trace def create_or_update( self, resource_group_name, # type: str @@ -146,34 +396,24 @@ def create_or_update( 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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = self._serialize.body(domain_resource, 'CustomDomainResource') + + request = build_create_or_update_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + domain_name=domain_name, + content_type=content_type, + json=_json, + template_url=self.create_or_update.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -187,8 +427,11 @@ def create_or_update( 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 + + @distributed_trace def delete( self, resource_group_name, # type: str @@ -219,29 +462,19 @@ def delete( 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 = build_delete_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + domain_name=domain_name, + template_url=self.delete.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -254,6 +487,8 @@ def delete( delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/domains/{domainName}'} # type: ignore + + @distributed_trace def patch( self, resource_group_name, # type: str @@ -287,34 +522,24 @@ def patch( 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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(domain_resource, 'CustomDomainResource') - # 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') + request = build_patch_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + domain_name=domain_name, + content_type=content_type, + json=_json, + template_url=self.patch.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -328,8 +553,11 @@ def patch( 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 + + @distributed_trace def list( self, resource_group_name, # type: str @@ -348,8 +576,10 @@ def list( :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.paging.ItemPaged[~azure.mgmt.appplatform.v2019_05_01_preview.models.CustomDomainResourceCollection] + :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"] @@ -357,37 +587,35 @@ def list( 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) + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('CustomDomainResourceCollection', pipeline_response) + deserialized = self._deserialize("CustomDomainResourceCollection", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -405,11 +633,13 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/domains'} # type: ignore + @distributed_trace def validate( self, resource_group_name, # type: str @@ -429,7 +659,8 @@ def validate( :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 + :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 @@ -440,33 +671,23 @@ def validate( 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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = self._serialize.body(validate_payload, 'CustomDomainValidatePayload') + + request = build_validate_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + content_type=content_type, + json=_json, + template_url=self.validate.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -480,4 +701,6 @@ def validate( 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/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2019_05_01_preview/operations/_deployments_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2019_05_01_preview/operations/_deployments_operations.py index 17e1d62979ba6..fc7e0dfe79d6b 100644 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2019_05_01_preview/operations/_deployments_operations.py +++ b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2019_05_01_preview/operations/_deployments_operations.py @@ -5,26 +5,444 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools from typing import TYPE_CHECKING import warnings 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.pipeline.transport import HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling +from msrest import Serializer from .. import models as _models +from .._vendor import _convert_request, _format_url_section 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]] +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False +# fmt: off + +def build_get_request( + subscription_id, # type: str + resource_group_name, # type: str + service_name, # type: str + app_name, # type: str + deployment_name, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + api_version = "2019-05-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), + "appName": _SERIALIZER.url("app_name", app_name, 'str'), + "deploymentName": _SERIALIZER.url("deployment_name", deployment_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_create_or_update_request_initial( + subscription_id, # type: str + resource_group_name, # type: str + service_name, # type: str + app_name, # type: str + deployment_name, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2019-05-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), + "appName": _SERIALIZER.url("app_name", app_name, 'str'), + "deploymentName": _SERIALIZER.url("deployment_name", deployment_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_delete_request( + subscription_id, # type: str + resource_group_name, # type: str + service_name, # type: str + app_name, # type: str + deployment_name, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + api_version = "2019-05-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), + "appName": _SERIALIZER.url("app_name", app_name, 'str'), + "deploymentName": _SERIALIZER.url("deployment_name", deployment_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="DELETE", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_update_request_initial( + subscription_id, # type: str + resource_group_name, # type: str + service_name, # type: str + app_name, # type: str + deployment_name, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2019-05-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), + "appName": _SERIALIZER.url("app_name", app_name, 'str'), + "deploymentName": _SERIALIZER.url("deployment_name", deployment_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PATCH", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_list_request( + subscription_id, # type: str + resource_group_name, # type: str + service_name, # type: str + app_name, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + version = kwargs.pop('version', None) # type: Optional[List[str]] + + api_version = "2019-05-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), + "appName": _SERIALIZER.url("app_name", app_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + if version is not None: + query_parameters['version'] = [_SERIALIZER.query("version", q, 'str') if q is not None else '' for q in version] + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_list_cluster_all_deployments_request( + subscription_id, # type: str + resource_group_name, # type: str + service_name, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + version = kwargs.pop('version', None) # type: Optional[List[str]] + + api_version = "2019-05-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/deployments') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + if version is not None: + query_parameters['version'] = [_SERIALIZER.query("version", q, 'str') if q is not None else '' for q in version] + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_start_request_initial( + subscription_id, # type: str + resource_group_name, # type: str + service_name, # type: str + app_name, # type: str + deployment_name, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + api_version = "2019-05-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/start') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), + "appName": _SERIALIZER.url("app_name", app_name, 'str'), + "deploymentName": _SERIALIZER.url("deployment_name", deployment_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_stop_request_initial( + subscription_id, # type: str + resource_group_name, # type: str + service_name, # type: str + app_name, # type: str + deployment_name, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + api_version = "2019-05-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/stop') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), + "appName": _SERIALIZER.url("app_name", app_name, 'str'), + "deploymentName": _SERIALIZER.url("deployment_name", deployment_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_restart_request_initial( + subscription_id, # type: str + resource_group_name, # type: str + service_name, # type: str + app_name, # type: str + deployment_name, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + api_version = "2019-05-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/restart') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), + "appName": _SERIALIZER.url("app_name", app_name, 'str'), + "deploymentName": _SERIALIZER.url("deployment_name", deployment_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_get_log_file_url_request( + subscription_id, # type: str + resource_group_name, # type: str + service_name, # type: str + app_name, # type: str + deployment_name, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + api_version = "2019-05-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/getLogFileUrl') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), + "appName": _SERIALIZER.url("app_name", app_name, 'str'), + "deploymentName": _SERIALIZER.url("deployment_name", deployment_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + +# fmt: on class DeploymentsOperations(object): """DeploymentsOperations operations. @@ -47,6 +465,7 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def get( self, resource_group_name, # type: str @@ -77,29 +496,19 @@ def get( 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 = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + deployment_name=deployment_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -113,8 +522,10 @@ def get( 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 + def _create_or_update_initial( self, resource_group_name, # type: str @@ -130,34 +541,24 @@ def _create_or_update_initial( 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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = self._serialize.body(deployment_resource, 'DeploymentResource') + + request = build_create_or_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + deployment_name=deployment_name, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -178,8 +579,11 @@ def _create_or_update_initial( 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 + + @distributed_trace def begin_create_or_update( self, resource_group_name, # type: str @@ -202,18 +606,24 @@ def begin_create_or_update( :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 + :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. + :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: + :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 """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.DeploymentResource"] lro_delay = kwargs.pop( 'polling_interval', @@ -227,29 +637,21 @@ def begin_create_or_update( app_name=app_name, deployment_name=deployment_name, deployment_resource=deployment_resource, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_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 = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -261,8 +663,10 @@ def get_long_running_output(pipeline_response): ) 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 + @distributed_trace def delete( self, resource_group_name, # type: str @@ -293,29 +697,19 @@ def delete( 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 = build_delete_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + deployment_name=deployment_name, + template_url=self.delete.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -328,6 +722,7 @@ def delete( 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, # type: str @@ -343,34 +738,24 @@ def _update_initial( 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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = self._serialize.body(deployment_resource, 'DeploymentResource') + + request = build_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + deployment_name=deployment_name, + content_type=content_type, + json=_json, + template_url=self._update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -388,8 +773,11 @@ def _update_initial( 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 + + @distributed_trace def begin_update( self, resource_group_name, # type: str @@ -412,18 +800,24 @@ def begin_update( :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 + :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. + :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: + :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 """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.DeploymentResource"] lro_delay = kwargs.pop( 'polling_interval', @@ -437,29 +831,21 @@ def begin_update( app_name=app_name, deployment_name=deployment_name, deployment_resource=deployment_resource, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_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 = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -471,8 +857,10 @@ def get_long_running_output(pipeline_response): ) 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 + @distributed_trace def list( self, resource_group_name, # type: str @@ -494,8 +882,10 @@ def list( :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.paging.ItemPaged[~azure.mgmt.appplatform.v2019_05_01_preview.models.DeploymentResourceCollection] + :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"] @@ -503,39 +893,37 @@ def list( 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) + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + version=version, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + version=version, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('DeploymentResourceCollection', pipeline_response) + deserialized = self._deserialize("DeploymentResourceCollection", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -553,11 +941,13 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments'} # type: ignore + @distributed_trace def list_cluster_all_deployments( self, resource_group_name, # type: str @@ -576,8 +966,10 @@ def list_cluster_all_deployments( :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.paging.ItemPaged[~azure.mgmt.appplatform.v2019_05_01_preview.models.DeploymentResourceCollection] + :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"] @@ -585,38 +977,35 @@ def list_cluster_all_deployments( 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) + + request = build_list_cluster_all_deployments_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + version=version, + template_url=self.list_cluster_all_deployments.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_cluster_all_deployments_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + version=version, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('DeploymentResourceCollection', pipeline_response) + deserialized = self._deserialize("DeploymentResourceCollection", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -634,6 +1023,7 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) @@ -653,29 +1043,19 @@ def _start_initial( 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 = build_start_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + deployment_name=deployment_name, + template_url=self._start_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -688,6 +1068,8 @@ def _start_initial( _start_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/start'} # type: ignore + + @distributed_trace def begin_start( self, resource_group_name, # type: str @@ -710,15 +1092,17 @@ def begin_start( :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 ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :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. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -734,23 +1118,14 @@ def begin_start( 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 = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -762,6 +1137,7 @@ def get_long_running_output(pipeline_response): ) 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( @@ -778,29 +1154,19 @@ def _stop_initial( 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 = build_stop_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + deployment_name=deployment_name, + template_url=self._stop_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -813,6 +1179,8 @@ def _stop_initial( _stop_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/stop'} # type: ignore + + @distributed_trace def begin_stop( self, resource_group_name, # type: str @@ -835,15 +1203,17 @@ def begin_stop( :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 ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :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. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -859,23 +1229,14 @@ def begin_stop( 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 = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -887,6 +1248,7 @@ def get_long_running_output(pipeline_response): ) 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( @@ -903,29 +1265,19 @@ def _restart_initial( 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 = build_restart_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + deployment_name=deployment_name, + template_url=self._restart_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -938,6 +1290,8 @@ def _restart_initial( _restart_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/restart'} # type: ignore + + @distributed_trace def begin_restart( self, resource_group_name, # type: str @@ -960,15 +1314,17 @@ def begin_restart( :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 ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :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. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -984,23 +1340,14 @@ def begin_restart( 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 = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -1012,8 +1359,10 @@ def get_long_running_output(pipeline_response): ) 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 + @distributed_trace def get_log_file_url( self, resource_group_name, # type: str @@ -1044,29 +1393,19 @@ def get_log_file_url( 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 = build_get_log_file_url_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + deployment_name=deployment_name, + template_url=self.get_log_file_url.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -1082,4 +1421,6 @@ def get_log_file_url( 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/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2019_05_01_preview/operations/_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2019_05_01_preview/operations/_operations.py index ec98a8ef76a42..dd40c425b094c 100644 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2019_05_01_preview/operations/_operations.py +++ b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2019_05_01_preview/operations/_operations.py @@ -5,24 +5,58 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools from typing import TYPE_CHECKING import warnings 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.pipeline.transport import HttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat +from msrest import Serializer from .. import models as _models +from .._vendor import _convert_request 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]] +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False +# fmt: off + +def build_list_request( + **kwargs # type: Any +): + # type: (...) -> HttpRequest + api_version = "2019-05-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/providers/Microsoft.AppPlatform/operations') + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + +# fmt: on class Operations(object): """Operations operations. @@ -45,6 +79,7 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def list( self, **kwargs # type: Any @@ -54,7 +89,8 @@ def list( :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] + :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"] @@ -62,30 +98,27 @@ def list( 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 = build_list_request( + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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) + + request = build_list_request( + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('AvailableOperations', pipeline_response) + deserialized = self._deserialize("AvailableOperations", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -103,6 +136,7 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2019_05_01_preview/operations/_runtime_versions_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2019_05_01_preview/operations/_runtime_versions_operations.py index d050faed2388a..ccd2cdaa34106 100644 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2019_05_01_preview/operations/_runtime_versions_operations.py +++ b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2019_05_01_preview/operations/_runtime_versions_operations.py @@ -5,23 +5,57 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools from typing import TYPE_CHECKING 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 HttpRequest, HttpResponse +from azure.core.pipeline.transport import HttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat +from msrest import Serializer from .. import models as _models +from .._vendor import _convert_request 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]] +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False +# fmt: off + +def build_list_runtime_versions_request( + **kwargs # type: Any +): + # type: (...) -> HttpRequest + api_version = "2019-05-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/providers/Microsoft.AppPlatform/runtimeVersions') + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + +# fmt: on class RuntimeVersionsOperations(object): """RuntimeVersionsOperations operations. @@ -44,6 +78,7 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def list_runtime_versions( self, **kwargs # type: Any @@ -61,21 +96,14 @@ def list_runtime_versions( 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 = build_list_runtime_versions_request( + template_url=self.list_runtime_versions.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -89,4 +117,6 @@ def list_runtime_versions( return cls(pipeline_response, deserialized, {}) return deserialized + list_runtime_versions.metadata = {'url': '/providers/Microsoft.AppPlatform/runtimeVersions'} # type: ignore + diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2019_05_01_preview/operations/_services_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2019_05_01_preview/operations/_services_operations.py index 8908a38ac8dab..bbf731dc5dc59 100644 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2019_05_01_preview/operations/_services_operations.py +++ b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2019_05_01_preview/operations/_services_operations.py @@ -5,26 +5,438 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools from typing import TYPE_CHECKING import warnings 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.pipeline.transport import HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling +from msrest import Serializer from .. import models as _models +from .._vendor import _convert_request, _format_url_section 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]] +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False +# fmt: off + +def build_get_request( + subscription_id, # type: str + resource_group_name, # type: str + service_name, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + api_version = "2019-05-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_create_or_update_request_initial( + subscription_id, # type: str + resource_group_name, # type: str + service_name, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2019-05-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_delete_request_initial( + subscription_id, # type: str + resource_group_name, # type: str + service_name, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + api_version = "2019-05-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="DELETE", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_update_request_initial( + subscription_id, # type: str + resource_group_name, # type: str + service_name, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2019-05-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PATCH", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_list_test_keys_request( + subscription_id, # type: str + resource_group_name, # type: str + service_name, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + api_version = "2019-05-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/listTestKeys') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_regenerate_test_key_request( + subscription_id, # type: str + resource_group_name, # type: str + service_name, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2019-05-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/regenerateTestKey') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_disable_test_endpoint_request( + subscription_id, # type: str + resource_group_name, # type: str + service_name, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + api_version = "2019-05-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/disableTestEndpoint') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_enable_test_endpoint_request( + subscription_id, # type: str + resource_group_name, # type: str + service_name, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + api_version = "2019-05-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/enableTestEndpoint') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_check_name_availability_request( + subscription_id, # type: str + location, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2019-05-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.AppPlatform/locations/{location}/checkNameAvailability') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "location": _SERIALIZER.url("location", location, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_list_by_subscription_request( + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + api_version = "2019-05-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.AppPlatform/Spring') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_list_request( + subscription_id, # type: str + resource_group_name, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + api_version = "2019-05-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + +# fmt: on class ServicesOperations(object): """ServicesOperations operations. @@ -47,6 +459,7 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def get( self, resource_group_name, # type: str @@ -71,27 +484,17 @@ def get( 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 = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -105,8 +508,10 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}'} # type: ignore + def _create_or_update_initial( self, resource_group_name, # type: str @@ -120,32 +525,22 @@ def _create_or_update_initial( 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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = self._serialize.body(resource, 'ServiceResource') + + request = build_create_or_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -163,8 +558,11 @@ def _create_or_update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}'} # type: ignore + + @distributed_trace def begin_create_or_update( self, resource_group_name, # type: str @@ -184,15 +582,20 @@ def begin_create_or_update( :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. + :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: + :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 """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.ServiceResource"] lro_delay = kwargs.pop( 'polling_interval', @@ -204,27 +607,21 @@ def begin_create_or_update( resource_group_name=resource_group_name, service_name=service_name, resource=resource, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_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 = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -236,6 +633,7 @@ def get_long_running_output(pipeline_response): ) 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( @@ -250,27 +648,17 @@ def _delete_initial( 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 = build_delete_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -283,6 +671,8 @@ def _delete_initial( _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}'} # type: ignore + + @distributed_trace def begin_delete( self, resource_group_name, # type: str @@ -299,15 +689,17 @@ def begin_delete( :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 ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :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. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -321,21 +713,14 @@ def begin_delete( 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 = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -347,6 +732,7 @@ def get_long_running_output(pipeline_response): ) 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( @@ -362,32 +748,22 @@ def _update_initial( 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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = self._serialize.body(resource, 'ServiceResource') + + request = build_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + content_type=content_type, + json=_json, + template_url=self._update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -405,8 +781,11 @@ def _update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}'} # type: ignore + + @distributed_trace def begin_update( self, resource_group_name, # type: str @@ -426,15 +805,20 @@ def begin_update( :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. + :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: + :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 """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.ServiceResource"] lro_delay = kwargs.pop( 'polling_interval', @@ -446,27 +830,21 @@ def begin_update( resource_group_name=resource_group_name, service_name=service_name, resource=resource, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_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 = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -478,8 +856,10 @@ def get_long_running_output(pipeline_response): ) 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 + @distributed_trace def list_test_keys( self, resource_group_name, # type: str @@ -504,27 +884,17 @@ def list_test_keys( 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 = build_list_test_keys_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + template_url=self.list_test_keys.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -538,8 +908,11 @@ def list_test_keys( return cls(pipeline_response, deserialized, {}) return deserialized + list_test_keys.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/listTestKeys'} # type: ignore + + @distributed_trace def regenerate_test_key( self, resource_group_name, # type: str @@ -556,7 +929,8 @@ def regenerate_test_key( :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 + :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 @@ -567,32 +941,22 @@ def regenerate_test_key( 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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = self._serialize.body(regenerate_test_key_request, 'RegenerateTestKeyRequestPayload') + + request = build_regenerate_test_key_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + content_type=content_type, + json=_json, + template_url=self.regenerate_test_key.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -606,8 +970,11 @@ def regenerate_test_key( return cls(pipeline_response, deserialized, {}) return deserialized + regenerate_test_key.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/regenerateTestKey'} # type: ignore + + @distributed_trace def disable_test_endpoint( self, resource_group_name, # type: str @@ -632,27 +999,17 @@ def disable_test_endpoint( 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 = build_disable_test_endpoint_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + template_url=self.disable_test_endpoint.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -665,6 +1022,8 @@ def disable_test_endpoint( disable_test_endpoint.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/disableTestEndpoint'} # type: ignore + + @distributed_trace def enable_test_endpoint( self, resource_group_name, # type: str @@ -689,27 +1048,17 @@ def enable_test_endpoint( 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 = build_enable_test_endpoint_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + template_url=self.enable_test_endpoint.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -723,8 +1072,11 @@ def enable_test_endpoint( return cls(pipeline_response, deserialized, {}) return deserialized + enable_test_endpoint.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/enableTestEndpoint'} # type: ignore + + @distributed_trace def check_name_availability( self, location, # type: str @@ -737,7 +1089,8 @@ def check_name_availability( :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 + :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 @@ -748,31 +1101,21 @@ def check_name_availability( 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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = self._serialize.body(availability_parameters, 'NameAvailabilityParameters') + + request = build_check_name_availability_request( + subscription_id=self._config.subscription_id, + location=location, + content_type=content_type, + json=_json, + template_url=self.check_name_availability.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -786,8 +1129,11 @@ def check_name_availability( return cls(pipeline_response, deserialized, {}) return deserialized + check_name_availability.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.AppPlatform/locations/{location}/checkNameAvailability'} # type: ignore + + @distributed_trace def list_by_subscription( self, **kwargs # type: Any @@ -797,7 +1143,8 @@ def list_by_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.paging.ItemPaged[~azure.mgmt.appplatform.v2019_05_01_preview.models.ServiceResourceList] + :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"] @@ -805,34 +1152,29 @@ def list_by_subscription( 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) + + request = build_list_by_subscription_request( + subscription_id=self._config.subscription_id, + template_url=self.list_by_subscription.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_subscription_request( + subscription_id=self._config.subscription_id, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('ServiceResourceList', pipeline_response) + deserialized = self._deserialize("ServiceResourceList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -850,11 +1192,13 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) list_by_subscription.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.AppPlatform/Spring'} # type: ignore + @distributed_trace def list( self, resource_group_name, # type: str @@ -868,7 +1212,8 @@ def list( :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.paging.ItemPaged[~azure.mgmt.appplatform.v2019_05_01_preview.models.ServiceResourceList] + :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"] @@ -876,35 +1221,31 @@ def list( 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) + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('ServiceResourceList', pipeline_response) + deserialized = self._deserialize("ServiceResourceList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -922,6 +1263,7 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2019_05_01_preview/operations/_sku_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2019_05_01_preview/operations/_sku_operations.py index 092aacde06d78..176841c17a24f 100644 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2019_05_01_preview/operations/_sku_operations.py +++ b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2019_05_01_preview/operations/_sku_operations.py @@ -5,24 +5,64 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools from typing import TYPE_CHECKING import warnings 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.pipeline.transport import HttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat +from msrest import Serializer from .. import models as _models +from .._vendor import _convert_request, _format_url_section 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]] +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False +# fmt: off + +def build_list_request( + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + api_version = "2019-05-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.AppPlatform/skus') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + +# fmt: on class SkuOperations(object): """SkuOperations operations. @@ -45,6 +85,7 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def list( self, **kwargs # type: Any @@ -53,8 +94,10 @@ def list( """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] + :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"] @@ -62,34 +105,29 @@ def list( 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) + + request = build_list_request( + subscription_id=self._config.subscription_id, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('ResourceSkuCollection', pipeline_response) + deserialized = self._deserialize("ResourceSkuCollection", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -107,6 +145,7 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2020_07_01/__init__.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2020_07_01/__init__.py index d2ddf950056ad..41ec6d71ff7fa 100644 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2020_07_01/__init__.py +++ b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2020_07_01/__init__.py @@ -12,8 +12,7 @@ __version__ = VERSION __all__ = ['AppPlatformManagementClient'] -try: - from ._patch import patch_sdk # type: ignore - patch_sdk() -except ImportError: - pass +# `._patch.py` is used for handwritten extensions to the generated code +# Example: https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md +from ._patch import patch_sdk +patch_sdk() diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2020_07_01/_app_platform_management_client.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2020_07_01/_app_platform_management_client.py index bbb07fef27c23..a6192a0c4bb03 100644 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2020_07_01/_app_platform_management_client.py +++ b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2020_07_01/_app_platform_management_client.py @@ -6,32 +6,22 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from copy import deepcopy from typing import TYPE_CHECKING from azure.mgmt.core import ARMPipelineClient from msrest import Deserializer, Serializer +from . import models +from ._configuration import AppPlatformManagementClientConfiguration +from .operations import AppsOperations, BindingsOperations, CertificatesOperations, ConfigServersOperations, CustomDomainsOperations, DeploymentsOperations, MonitoringSettingsOperations, Operations, RuntimeVersionsOperations, ServicesOperations, SkusOperations + 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 -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 - + from azure.core.rest import HttpRequest, HttpResponse class AppPlatformManagementClient(object): """REST API for Azure Spring Cloud. @@ -41,7 +31,8 @@ class AppPlatformManagementClient(object): :ivar config_servers: ConfigServersOperations operations :vartype config_servers: azure.mgmt.appplatform.v2020_07_01.operations.ConfigServersOperations :ivar monitoring_settings: MonitoringSettingsOperations operations - :vartype monitoring_settings: azure.mgmt.appplatform.v2020_07_01.operations.MonitoringSettingsOperations + :vartype monitoring_settings: + azure.mgmt.appplatform.v2020_07_01.operations.MonitoringSettingsOperations :ivar apps: AppsOperations operations :vartype apps: azure.mgmt.appplatform.v2020_07_01.operations.AppsOperations :ivar bindings: BindingsOperations operations @@ -55,75 +46,75 @@ class AppPlatformManagementClient(object): :ivar operations: Operations operations :vartype operations: azure.mgmt.appplatform.v2020_07_01.operations.Operations :ivar runtime_versions: RuntimeVersionsOperations operations - :vartype runtime_versions: azure.mgmt.appplatform.v2020_07_01.operations.RuntimeVersionsOperations + :vartype runtime_versions: + azure.mgmt.appplatform.v2020_07_01.operations.RuntimeVersionsOperations :ivar skus: SkusOperations operations :vartype skus: azure.mgmt.appplatform.v2020_07_01.operations.SkusOperations :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. + :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. + :param base_url: Service URL. Default value is 'https://management.azure.com'. + :type base_url: str + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. """ def __init__( self, credential, # type: "TokenCredential" subscription_id, # type: str - base_url=None, # type: Optional[str] + base_url="https://management.azure.com", # type: str **kwargs # type: Any ): # type: (...) -> None - if not base_url: - base_url = 'https://management.azure.com' - self._config = AppPlatformManagementClientConfiguration(credential, subscription_id, **kwargs) + self._config = AppPlatformManagementClientConfiguration(credential=credential, subscription_id=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._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) - - def _send_request(self, http_request, **kwargs): - # type: (HttpRequest, Any) -> HttpResponse + self._serialize.client_side_validation = False + 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) + + + def _send_request( + self, + request, # type: HttpRequest + **kwargs # type: Any + ): + # type: (...) -> 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. + >>> from azure.core.rest import HttpRequest + >>> request = HttpRequest("GET", "https://www.example.org/") + + >>> response = client._send_request(request) + + + For more information on this code flow, see https://aka.ms/azsdk/python/protocol/quickstart + + :param request: The network request you want to make. Required. + :type request: ~azure.core.rest.HttpRequest + :keyword bool stream: Whether the response payload will be streamed. Defaults to False. :return: The response of your network call. Does not do error handling on your response. - :rtype: ~azure.core.pipeline.transport.HttpResponse + :rtype: ~azure.core.rest.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 + + request_copy = deepcopy(request) + request_copy.url = self._client.format_url(request_copy.url) + return self._client.send_request(request_copy, **kwargs) def close(self): # type: () -> None diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2020_07_01/_configuration.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2020_07_01/_configuration.py index 2e027c5345933..61336dbcae2e0 100644 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2020_07_01/_configuration.py +++ b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2020_07_01/_configuration.py @@ -10,7 +10,7 @@ from azure.core.configuration import Configuration from azure.core.pipeline import policies -from azure.mgmt.core.policies import ARMHttpLoggingPolicy +from azure.mgmt.core.policies import ARMChallengeAuthenticationPolicy, ARMHttpLoggingPolicy from ._version import VERSION @@ -40,11 +40,11 @@ def __init__( **kwargs # type: Any ): # type: (...) -> None + super(AppPlatformManagementClientConfiguration, self).__init__(**kwargs) 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 @@ -68,4 +68,4 @@ def _configure( 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) + self.authentication_policy = ARMChallengeAuthenticationPolicy(self.credential, *self.credential_scopes, **kwargs) diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2020_07_01/_metadata.json b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2020_07_01/_metadata.json index 1f417c7fc3fb5..acc998545026a 100644 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2020_07_01/_metadata.json +++ b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2020_07_01/_metadata.json @@ -5,13 +5,13 @@ "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, + "host_value": "\"https://management.azure.com\"", + "parameterized_host_template": 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\"]}}}" + "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\"]}}}", + "async_imports": "{\"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"], \"azure.core.credentials\": [\"TokenCredential\"]}}, \"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\"]}}}" }, "global_parameters": { "sync": { @@ -54,7 +54,7 @@ "required": false }, "base_url": { - "signature": "base_url=None, # type: Optional[str]", + "signature": "base_url=\"https://management.azure.com\", # type: str", "description": "Service URL", "docstring_type": "str", "required": false @@ -74,7 +74,7 @@ "required": false }, "base_url": { - "signature": "base_url: Optional[str] = None,", + "signature": "base_url: str = \"https://management.azure.com\",", "description": "Service URL", "docstring_type": "str", "required": false @@ -91,11 +91,10 @@ "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\"]}}}" + "credential_call_sync": "ARMChallengeAuthenticationPolicy(self.credential, *self.credential_scopes, **kwargs)", + "credential_call_async": "AsyncARMChallengeAuthenticationPolicy(self.credential, *self.credential_scopes, **kwargs)", + "sync_imports": "{\"regular\": {\"azurecore\": {\"azure.core.configuration\": [\"Configuration\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMChallengeAuthenticationPolicy\", \"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\", \"AsyncARMChallengeAuthenticationPolicy\"]}, \"local\": {\".._version\": [\"VERSION\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\"]}}, \"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}}" }, "operation_groups": { "services": "ServicesOperations", diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2020_07_01/_patch.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2020_07_01/_patch.py new file mode 100644 index 0000000000000..74e48ecd07cf3 --- /dev/null +++ b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2020_07_01/_patch.py @@ -0,0 +1,31 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# +# Copyright (c) Microsoft Corporation. All rights reserved. +# +# The MIT License (MIT) +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the ""Software""), to +# deal in the Software without restriction, including without limitation the +# rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +# sell copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in +# all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED *AS IS*, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +# IN THE SOFTWARE. +# +# -------------------------------------------------------------------------- + +# This file is used for handwritten extensions to the generated code. Example: +# https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md +def patch_sdk(): + pass \ No newline at end of file diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2020_07_01/_vendor.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2020_07_01/_vendor.py new file mode 100644 index 0000000000000..138f663c53a4e --- /dev/null +++ b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2020_07_01/_vendor.py @@ -0,0 +1,27 @@ +# -------------------------------------------------------------------------- +# 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 azure.core.pipeline.transport import HttpRequest + +def _convert_request(request, files=None): + data = request.content if not files else None + request = HttpRequest(method=request.method, url=request.url, headers=request.headers, data=data) + if files: + request.set_formdata_body(files) + return request + +def _format_url_section(template, **kwargs): + components = template.split("/") + while components: + try: + return template.format(**kwargs) + except KeyError as key: + formatted_components = template.split("/") + components = [ + c for c in formatted_components if "{}".format(key.args[0]) not in c + ] + template = "/".join(components) diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2020_07_01/_version.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2020_07_01/_version.py index 92453d8691d96..e5754a47ce68f 100644 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2020_07_01/_version.py +++ b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2020_07_01/_version.py @@ -6,4 +6,4 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "6.1.0" +VERSION = "1.0.0b1" diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2020_07_01/aio/__init__.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2020_07_01/aio/__init__.py index 39f1054887358..44ce4a5043f80 100644 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2020_07_01/aio/__init__.py +++ b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2020_07_01/aio/__init__.py @@ -8,3 +8,8 @@ from ._app_platform_management_client import AppPlatformManagementClient __all__ = ['AppPlatformManagementClient'] + +# `._patch.py` is used for handwritten extensions to the generated code +# Example: https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md +from ._patch import patch_sdk +patch_sdk() diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2020_07_01/aio/_app_platform_management_client.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2020_07_01/aio/_app_platform_management_client.py index 497d1a0e0b056..df2038c8e41c2 100644 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2020_07_01/aio/_app_platform_management_client.py +++ b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2020_07_01/aio/_app_platform_management_client.py @@ -6,40 +6,32 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, Optional, TYPE_CHECKING +from copy import deepcopy +from typing import Any, Awaitable, Optional, TYPE_CHECKING -from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.mgmt.core import AsyncARMPipelineClient from msrest import Deserializer, Serializer +from .. import models +from ._configuration import AppPlatformManagementClientConfiguration +from .operations import AppsOperations, BindingsOperations, CertificatesOperations, ConfigServersOperations, CustomDomainsOperations, DeploymentsOperations, MonitoringSettingsOperations, Operations, RuntimeVersionsOperations, ServicesOperations, SkusOperations + 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): +class AppPlatformManagementClient: """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 + :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 + :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 @@ -47,79 +39,80 @@ class AppPlatformManagementClient(object): :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 + :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 + :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. + :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. + :param base_url: Service URL. Default value is 'https://management.azure.com'. + :type base_url: str + :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, + base_url: str = "https://management.azure.com", **kwargs: Any ) -> None: - if not base_url: - base_url = 'https://management.azure.com' - self._config = AppPlatformManagementClientConfiguration(credential, subscription_id, **kwargs) + self._config = AppPlatformManagementClientConfiguration(credential=credential, subscription_id=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._serialize.client_side_validation = False + 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) + - 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: + def _send_request( + self, + request: HttpRequest, + **kwargs: Any + ) -> Awaitable[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. + >>> from azure.core.rest import HttpRequest + >>> request = HttpRequest("GET", "https://www.example.org/") + + >>> response = await client._send_request(request) + + + For more information on this code flow, see https://aka.ms/azsdk/python/protocol/quickstart + + :param request: The network request you want to make. Required. + :type request: ~azure.core.rest.HttpRequest + :keyword bool stream: Whether the response payload will be streamed. Defaults to False. :return: The response of your network call. Does not do error handling on your response. - :rtype: ~azure.core.pipeline.transport.AsyncHttpResponse + :rtype: ~azure.core.rest.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 + + request_copy = deepcopy(request) + request_copy.url = self._client.format_url(request_copy.url) + return self._client.send_request(request_copy, **kwargs) async def close(self) -> None: await self._client.close() diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2020_07_01/aio/_configuration.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2020_07_01/aio/_configuration.py index 101a93f7aef9b..85cc47a5a0940 100644 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2020_07_01/aio/_configuration.py +++ b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2020_07_01/aio/_configuration.py @@ -10,7 +10,7 @@ from azure.core.configuration import Configuration from azure.core.pipeline import policies -from azure.mgmt.core.policies import ARMHttpLoggingPolicy +from azure.mgmt.core.policies import ARMHttpLoggingPolicy, AsyncARMChallengeAuthenticationPolicy from .._version import VERSION @@ -37,11 +37,11 @@ def __init__( subscription_id: str, **kwargs: Any ) -> None: + super(AppPlatformManagementClientConfiguration, self).__init__(**kwargs) 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 @@ -64,4 +64,4 @@ def _configure( 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) + self.authentication_policy = AsyncARMChallengeAuthenticationPolicy(self.credential, *self.credential_scopes, **kwargs) diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2020_07_01/aio/_patch.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2020_07_01/aio/_patch.py new file mode 100644 index 0000000000000..74e48ecd07cf3 --- /dev/null +++ b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2020_07_01/aio/_patch.py @@ -0,0 +1,31 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# +# Copyright (c) Microsoft Corporation. All rights reserved. +# +# The MIT License (MIT) +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the ""Software""), to +# deal in the Software without restriction, including without limitation the +# rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +# sell copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in +# all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED *AS IS*, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +# IN THE SOFTWARE. +# +# -------------------------------------------------------------------------- + +# This file is used for handwritten extensions to the generated code. Example: +# https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md +def patch_sdk(): + pass \ No newline at end of file diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2020_07_01/aio/operations/_apps_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2020_07_01/aio/operations/_apps_operations.py index 96a7b447e45fd..314df0b96a2c6 100644 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2020_07_01/aio/operations/_apps_operations.py +++ b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2020_07_01/aio/operations/_apps_operations.py @@ -5,19 +5,24 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools 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.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._apps_operations import build_create_or_update_request_initial, build_delete_request_initial, build_get_request, build_get_resource_upload_url_request, build_list_request, build_update_request_initial, build_validate_domain_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -43,6 +48,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace_async async def get( self, resource_group_name: str, @@ -72,30 +78,19 @@ async def get( 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 = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + sync_status=sync_status, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -109,8 +104,10 @@ async def get( 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, @@ -124,33 +121,23 @@ async def _create_or_update_initial( 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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = self._serialize.body(app_resource, 'AppResource') + + request = build_create_or_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -171,8 +158,11 @@ async def _create_or_update_initial( 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 + + @distributed_trace_async async def begin_create_or_update( self, resource_group_name: str, @@ -194,15 +184,20 @@ async def begin_create_or_update( :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. + :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: + :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] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.AppResource"] lro_delay = kwargs.pop( 'polling_interval', @@ -215,28 +210,21 @@ async def begin_create_or_update( service_name=service_name, app_name=app_name, app_resource=app_resource, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_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) + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -248,6 +236,7 @@ def get_long_running_output(pipeline_response): ) 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( @@ -262,28 +251,18 @@ async def _delete_initial( 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 = build_delete_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -296,6 +275,8 @@ async def _delete_initial( _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}'} # type: ignore + + @distributed_trace_async async def begin_delete( self, resource_group_name: str, @@ -314,15 +295,17 @@ async def begin_delete( :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. + :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. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -337,22 +320,14 @@ async def begin_delete( 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) + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -364,6 +339,7 @@ def get_long_running_output(pipeline_response): ) 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( @@ -379,33 +355,23 @@ async def _update_initial( 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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(app_resource, 'AppResource') - # 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') + request = build_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + content_type=content_type, + json=_json, + template_url=self._update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -423,8 +389,11 @@ async def _update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}'} # type: ignore + + @distributed_trace_async async def begin_update( self, resource_group_name: str, @@ -446,15 +415,20 @@ async def begin_update( :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. + :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: + :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] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.AppResource"] lro_delay = kwargs.pop( 'polling_interval', @@ -467,28 +441,21 @@ async def begin_update( service_name=service_name, app_name=app_name, app_resource=app_resource, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_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) + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -500,8 +467,10 @@ def get_long_running_output(pipeline_response): ) 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 + @distributed_trace def list( self, resource_group_name: str, @@ -516,8 +485,10 @@ def list( :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] + :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"] @@ -525,36 +496,33 @@ def list( 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) + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('AppResourceCollection', pipeline_response) + deserialized = self._deserialize("AppResourceCollection", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -572,11 +540,13 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps'} # type: ignore + @distributed_trace_async async def get_resource_upload_url( self, resource_group_name: str, @@ -603,28 +573,18 @@ async def get_resource_upload_url( 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 = build_get_resource_upload_url_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + template_url=self.get_resource_upload_url.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -638,8 +598,11 @@ async def get_resource_upload_url( 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 + + @distributed_trace_async async def validate_domain( self, resource_group_name: str, @@ -669,33 +632,23 @@ async def validate_domain( 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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(validate_payload, 'CustomDomainValidatePayload') - # 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') + request = build_validate_domain_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + content_type=content_type, + json=_json, + template_url=self.validate_domain.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -709,4 +662,6 @@ async def validate_domain( 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/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2020_07_01/aio/operations/_bindings_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2020_07_01/aio/operations/_bindings_operations.py index 732cfe5da5cd8..9b35f296e63bc 100644 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2020_07_01/aio/operations/_bindings_operations.py +++ b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2020_07_01/aio/operations/_bindings_operations.py @@ -5,19 +5,24 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools 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.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._bindings_operations import build_create_or_update_request_initial, build_delete_request_initial, build_get_request, build_list_request, build_update_request_initial T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -43,6 +48,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace_async async def get( self, resource_group_name: str, @@ -72,29 +78,19 @@ async def get( 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 = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + binding_name=binding_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -108,8 +104,10 @@ async def get( 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, @@ -124,34 +122,24 @@ async def _create_or_update_initial( 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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = self._serialize.body(binding_resource, 'BindingResource') + + request = build_create_or_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + binding_name=binding_name, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -172,8 +160,11 @@ async def _create_or_update_initial( 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 + + @distributed_trace_async async def begin_create_or_update( self, resource_group_name: str, @@ -198,15 +189,20 @@ async def begin_create_or_update( :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. + :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: + :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] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.BindingResource"] lro_delay = kwargs.pop( 'polling_interval', @@ -220,29 +216,21 @@ async def begin_create_or_update( app_name=app_name, binding_name=binding_name, binding_resource=binding_resource, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_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) + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -254,6 +242,7 @@ def get_long_running_output(pipeline_response): ) 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( @@ -269,29 +258,19 @@ async def _delete_initial( 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 = build_delete_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + binding_name=binding_name, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -304,6 +283,8 @@ async def _delete_initial( _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/bindings/{bindingName}'} # type: ignore + + @distributed_trace_async async def begin_delete( self, resource_group_name: str, @@ -325,15 +306,17 @@ async def begin_delete( :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. + :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. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -349,23 +332,14 @@ async def begin_delete( 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) + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -377,6 +351,7 @@ def get_long_running_output(pipeline_response): ) 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( @@ -393,34 +368,24 @@ async def _update_initial( 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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(binding_resource, 'BindingResource') - # 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') + request = build_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + binding_name=binding_name, + content_type=content_type, + json=_json, + template_url=self._update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -438,8 +403,11 @@ async def _update_initial( 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 + + @distributed_trace_async async def begin_update( self, resource_group_name: str, @@ -464,15 +432,20 @@ async def begin_update( :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. + :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: + :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] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.BindingResource"] lro_delay = kwargs.pop( 'polling_interval', @@ -486,29 +459,21 @@ async def begin_update( app_name=app_name, binding_name=binding_name, binding_resource=binding_resource, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_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) + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -520,8 +485,10 @@ def get_long_running_output(pipeline_response): ) 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 + @distributed_trace def list( self, resource_group_name: str, @@ -539,8 +506,10 @@ def list( :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] + :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"] @@ -548,37 +517,35 @@ def list( 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) + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('BindingResourceCollection', pipeline_response) + deserialized = self._deserialize("BindingResourceCollection", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -596,6 +563,7 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2020_07_01/aio/operations/_certificates_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2020_07_01/aio/operations/_certificates_operations.py index 6407846b0e550..86afd95863ad1 100644 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2020_07_01/aio/operations/_certificates_operations.py +++ b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2020_07_01/aio/operations/_certificates_operations.py @@ -5,19 +5,24 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools 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.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._certificates_operations import build_create_or_update_request_initial, build_delete_request_initial, build_get_request, build_list_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -43,6 +48,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace_async async def get( self, resource_group_name: str, @@ -69,28 +75,18 @@ async def get( 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 = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + certificate_name=certificate_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -104,8 +100,10 @@ async def get( 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, @@ -119,33 +117,23 @@ async def _create_or_update_initial( 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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = self._serialize.body(certificate_resource, 'CertificateResource') + + request = build_create_or_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + certificate_name=certificate_name, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -166,8 +154,11 @@ async def _create_or_update_initial( 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 + + @distributed_trace_async async def begin_create_or_update( self, resource_group_name: str, @@ -189,15 +180,20 @@ async def begin_create_or_update( :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. + :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: + :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] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.CertificateResource"] lro_delay = kwargs.pop( 'polling_interval', @@ -210,28 +206,21 @@ async def begin_create_or_update( service_name=service_name, certificate_name=certificate_name, certificate_resource=certificate_resource, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_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) + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -243,6 +232,7 @@ def get_long_running_output(pipeline_response): ) 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( @@ -257,28 +247,18 @@ async def _delete_initial( 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 = build_delete_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + certificate_name=certificate_name, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -291,6 +271,8 @@ async def _delete_initial( _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/certificates/{certificateName}'} # type: ignore + + @distributed_trace_async async def begin_delete( self, resource_group_name: str, @@ -309,15 +291,17 @@ async def begin_delete( :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. + :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. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -332,22 +316,14 @@ async def begin_delete( 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) + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -359,8 +335,10 @@ def get_long_running_output(pipeline_response): ) 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 + @distributed_trace def list( self, resource_group_name: str, @@ -375,8 +353,10 @@ def list( :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] + :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"] @@ -384,36 +364,33 @@ def list( 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) + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('CertificateResourceCollection', pipeline_response) + deserialized = self._deserialize("CertificateResourceCollection", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -431,6 +408,7 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2020_07_01/aio/operations/_config_servers_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2020_07_01/aio/operations/_config_servers_operations.py index 7e48efe0d068d..04f807b6fe46c 100644 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2020_07_01/aio/operations/_config_servers_operations.py +++ b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2020_07_01/aio/operations/_config_servers_operations.py @@ -5,18 +5,22 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools 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.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._config_servers_operations import build_get_request, build_update_patch_request_initial, build_update_put_request_initial, build_validate_request_initial T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -42,6 +46,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace_async async def get( self, resource_group_name: str, @@ -65,27 +70,17 @@ async def get( 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 = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -99,8 +94,10 @@ async def get( 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, @@ -113,32 +110,22 @@ async def _update_put_initial( 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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = self._serialize.body(config_server_resource, 'ConfigServerResource') + + request = build_update_put_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + content_type=content_type, + json=_json, + template_url=self._update_put_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -156,8 +143,11 @@ async def _update_put_initial( 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 + + @distributed_trace_async async def begin_update_put( self, resource_group_name: str, @@ -176,15 +166,20 @@ async def begin_update_put( :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. + :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: + :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] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.ConfigServerResource"] lro_delay = kwargs.pop( 'polling_interval', @@ -196,27 +191,21 @@ async def begin_update_put( resource_group_name=resource_group_name, service_name=service_name, config_server_resource=config_server_resource, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_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) + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -228,6 +217,7 @@ def get_long_running_output(pipeline_response): ) 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( @@ -242,32 +232,22 @@ async def _update_patch_initial( 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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(config_server_resource, 'ConfigServerResource') - # 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') + request = build_update_patch_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + content_type=content_type, + json=_json, + template_url=self._update_patch_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -285,8 +265,11 @@ async def _update_patch_initial( 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 + + @distributed_trace_async async def begin_update_patch( self, resource_group_name: str, @@ -305,15 +288,20 @@ async def begin_update_patch( :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. + :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: + :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] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.ConfigServerResource"] lro_delay = kwargs.pop( 'polling_interval', @@ -325,27 +313,21 @@ async def begin_update_patch( resource_group_name=resource_group_name, service_name=service_name, config_server_resource=config_server_resource, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_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) + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -357,6 +339,7 @@ def get_long_running_output(pipeline_response): ) 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( @@ -371,32 +354,22 @@ async def _validate_initial( 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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = self._serialize.body(config_server_settings, 'ConfigServerSettings') + + request = build_validate_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + content_type=content_type, + json=_json, + template_url=self._validate_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -414,8 +387,11 @@ async def _validate_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _validate_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configServers/validate'} # type: ignore + + @distributed_trace_async async def begin_validate( self, resource_group_name: str, @@ -434,15 +410,20 @@ async def begin_validate( :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. + :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: + :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] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.ConfigServerSettingsValidateResult"] lro_delay = kwargs.pop( 'polling_interval', @@ -454,27 +435,21 @@ async def begin_validate( resource_group_name=resource_group_name, service_name=service_name, config_server_settings=config_server_settings, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_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) + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -486,4 +461,5 @@ def get_long_running_output(pipeline_response): ) 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/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2020_07_01/aio/operations/_custom_domains_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2020_07_01/aio/operations/_custom_domains_operations.py index 46bb8daccbcc4..4a4bfe10b0340 100644 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2020_07_01/aio/operations/_custom_domains_operations.py +++ b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2020_07_01/aio/operations/_custom_domains_operations.py @@ -5,19 +5,24 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools 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.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._custom_domains_operations import build_create_or_update_request_initial, build_delete_request_initial, build_get_request, build_list_request, build_update_request_initial T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -43,6 +48,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace_async async def get( self, resource_group_name: str, @@ -72,29 +78,19 @@ async def get( 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 = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + domain_name=domain_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -108,8 +104,10 @@ async def get( 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, @@ -124,34 +122,24 @@ async def _create_or_update_initial( 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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = self._serialize.body(domain_resource, 'CustomDomainResource') + + request = build_create_or_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + domain_name=domain_name, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -172,8 +160,11 @@ async def _create_or_update_initial( 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 + + @distributed_trace_async async def begin_create_or_update( self, resource_group_name: str, @@ -198,15 +189,20 @@ async def begin_create_or_update( :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. + :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: + :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] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.CustomDomainResource"] lro_delay = kwargs.pop( 'polling_interval', @@ -220,29 +216,21 @@ async def begin_create_or_update( app_name=app_name, domain_name=domain_name, domain_resource=domain_resource, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_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) + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -254,6 +242,7 @@ def get_long_running_output(pipeline_response): ) 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( @@ -269,29 +258,19 @@ async def _delete_initial( 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 = build_delete_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + domain_name=domain_name, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -304,6 +283,8 @@ async def _delete_initial( _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/domains/{domainName}'} # type: ignore + + @distributed_trace_async async def begin_delete( self, resource_group_name: str, @@ -325,15 +306,17 @@ async def begin_delete( :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. + :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. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -349,23 +332,14 @@ async def begin_delete( 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) + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -377,6 +351,7 @@ def get_long_running_output(pipeline_response): ) 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( @@ -393,34 +368,24 @@ async def _update_initial( 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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(domain_resource, 'CustomDomainResource') - # 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') + request = build_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + domain_name=domain_name, + content_type=content_type, + json=_json, + template_url=self._update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -438,8 +403,11 @@ async def _update_initial( 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 + + @distributed_trace_async async def begin_update( self, resource_group_name: str, @@ -464,15 +432,20 @@ async def begin_update( :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. + :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: + :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] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.CustomDomainResource"] lro_delay = kwargs.pop( 'polling_interval', @@ -486,29 +459,21 @@ async def begin_update( app_name=app_name, domain_name=domain_name, domain_resource=domain_resource, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_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) + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -520,8 +485,10 @@ def get_long_running_output(pipeline_response): ) 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 + @distributed_trace def list( self, resource_group_name: str, @@ -539,8 +506,10 @@ def list( :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] + :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"] @@ -548,37 +517,35 @@ def list( 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) + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('CustomDomainResourceCollection', pipeline_response) + deserialized = self._deserialize("CustomDomainResourceCollection", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -596,6 +563,7 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2020_07_01/aio/operations/_deployments_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2020_07_01/aio/operations/_deployments_operations.py index 36566cc712b1c..cacf29f88f81b 100644 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2020_07_01/aio/operations/_deployments_operations.py +++ b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2020_07_01/aio/operations/_deployments_operations.py @@ -5,19 +5,24 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools 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.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._deployments_operations import build_create_or_update_request_initial, build_delete_request_initial, build_get_log_file_url_request, build_get_request, build_list_for_cluster_request, build_list_request, build_restart_request_initial, build_start_request_initial, build_stop_request_initial, build_update_request_initial T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -43,6 +48,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace_async async def get( self, resource_group_name: str, @@ -72,29 +78,19 @@ async def get( 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 = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + deployment_name=deployment_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -108,8 +104,10 @@ async def get( 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, @@ -124,34 +122,24 @@ async def _create_or_update_initial( 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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = self._serialize.body(deployment_resource, 'DeploymentResource') + + request = build_create_or_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + deployment_name=deployment_name, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -172,8 +160,11 @@ async def _create_or_update_initial( 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 + + @distributed_trace_async async def begin_create_or_update( self, resource_group_name: str, @@ -198,15 +189,20 @@ async def begin_create_or_update( :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. + :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: + :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] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.DeploymentResource"] lro_delay = kwargs.pop( 'polling_interval', @@ -220,29 +216,21 @@ async def begin_create_or_update( app_name=app_name, deployment_name=deployment_name, deployment_resource=deployment_resource, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_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) + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -254,6 +242,7 @@ def get_long_running_output(pipeline_response): ) 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( @@ -269,29 +258,19 @@ async def _delete_initial( 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 = build_delete_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + deployment_name=deployment_name, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -304,6 +283,8 @@ async def _delete_initial( _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}'} # type: ignore + + @distributed_trace_async async def begin_delete( self, resource_group_name: str, @@ -325,15 +306,17 @@ async def begin_delete( :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. + :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. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -349,23 +332,14 @@ async def begin_delete( 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) + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -377,6 +351,7 @@ def get_long_running_output(pipeline_response): ) 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( @@ -393,34 +368,24 @@ async def _update_initial( 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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = self._serialize.body(deployment_resource, 'DeploymentResource') + + request = build_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + deployment_name=deployment_name, + content_type=content_type, + json=_json, + template_url=self._update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -438,8 +403,11 @@ async def _update_initial( 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 + + @distributed_trace_async async def begin_update( self, resource_group_name: str, @@ -464,15 +432,20 @@ async def begin_update( :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. + :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: + :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] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.DeploymentResource"] lro_delay = kwargs.pop( 'polling_interval', @@ -486,29 +459,21 @@ async def begin_update( app_name=app_name, deployment_name=deployment_name, deployment_resource=deployment_resource, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_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) + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -520,8 +485,10 @@ def get_long_running_output(pipeline_response): ) 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 + @distributed_trace def list( self, resource_group_name: str, @@ -542,8 +509,10 @@ def list( :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] + :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"] @@ -551,39 +520,37 @@ def list( 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) + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + version=version, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + version=version, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('DeploymentResourceCollection', pipeline_response) + deserialized = self._deserialize("DeploymentResourceCollection", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -601,11 +568,13 @@ async def get_next(next_link=None): 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 + @distributed_trace def list_for_cluster( self, resource_group_name: str, @@ -623,8 +592,10 @@ def list_for_cluster( :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] + :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"] @@ -632,38 +603,35 @@ def list_for_cluster( 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) + + request = build_list_for_cluster_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + version=version, + template_url=self.list_for_cluster.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_for_cluster_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + version=version, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('DeploymentResourceCollection', pipeline_response) + deserialized = self._deserialize("DeploymentResourceCollection", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -681,6 +649,7 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) @@ -699,29 +668,19 @@ async def _start_initial( 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 = build_start_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + deployment_name=deployment_name, + template_url=self._start_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -734,6 +693,8 @@ async def _start_initial( _start_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/start'} # type: ignore + + @distributed_trace_async async def begin_start( self, resource_group_name: str, @@ -755,15 +716,17 @@ async def begin_start( :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. + :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. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -779,23 +742,14 @@ async def begin_start( 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) + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -807,6 +761,7 @@ def get_long_running_output(pipeline_response): ) 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( @@ -822,29 +777,19 @@ async def _stop_initial( 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 = build_stop_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + deployment_name=deployment_name, + template_url=self._stop_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -857,6 +802,8 @@ async def _stop_initial( _stop_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/stop'} # type: ignore + + @distributed_trace_async async def begin_stop( self, resource_group_name: str, @@ -878,15 +825,17 @@ async def begin_stop( :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. + :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. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -902,23 +851,14 @@ async def begin_stop( 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) + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -930,6 +870,7 @@ def get_long_running_output(pipeline_response): ) 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( @@ -945,29 +886,19 @@ async def _restart_initial( 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 = build_restart_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + deployment_name=deployment_name, + template_url=self._restart_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -980,6 +911,8 @@ async def _restart_initial( _restart_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/restart'} # type: ignore + + @distributed_trace_async async def begin_restart( self, resource_group_name: str, @@ -1001,15 +934,17 @@ async def begin_restart( :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. + :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. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -1025,23 +960,14 @@ async def begin_restart( 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) + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -1053,8 +979,10 @@ def get_long_running_output(pipeline_response): ) 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 + @distributed_trace_async async def get_log_file_url( self, resource_group_name: str, @@ -1084,29 +1012,19 @@ async def get_log_file_url( 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 = build_get_log_file_url_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + deployment_name=deployment_name, + template_url=self.get_log_file_url.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -1122,4 +1040,6 @@ async def get_log_file_url( 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/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2020_07_01/aio/operations/_monitoring_settings_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2020_07_01/aio/operations/_monitoring_settings_operations.py index 4dc1442371f5b..3093737012ccf 100644 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2020_07_01/aio/operations/_monitoring_settings_operations.py +++ b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2020_07_01/aio/operations/_monitoring_settings_operations.py @@ -5,18 +5,22 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools 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.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._monitoring_settings_operations import build_get_request, build_update_patch_request_initial, build_update_put_request_initial T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -42,6 +46,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace_async async def get( self, resource_group_name: str, @@ -65,27 +70,17 @@ async def get( 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 = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -99,8 +94,10 @@ async def get( 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, @@ -113,32 +110,22 @@ async def _update_put_initial( 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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = self._serialize.body(monitoring_setting_resource, 'MonitoringSettingResource') + + request = build_update_put_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + content_type=content_type, + json=_json, + template_url=self._update_put_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -156,8 +143,11 @@ async def _update_put_initial( 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 + + @distributed_trace_async async def begin_update_put( self, resource_group_name: str, @@ -173,18 +163,24 @@ async def begin_update_put( :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 + :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. + :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: + :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] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.MonitoringSettingResource"] lro_delay = kwargs.pop( 'polling_interval', @@ -196,27 +192,21 @@ async def begin_update_put( resource_group_name=resource_group_name, service_name=service_name, monitoring_setting_resource=monitoring_setting_resource, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_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) + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -228,6 +218,7 @@ def get_long_running_output(pipeline_response): ) 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( @@ -242,32 +233,22 @@ async def _update_patch_initial( 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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = self._serialize.body(monitoring_setting_resource, 'MonitoringSettingResource') + + request = build_update_patch_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + content_type=content_type, + json=_json, + template_url=self._update_patch_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -285,8 +266,11 @@ async def _update_patch_initial( 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 + + @distributed_trace_async async def begin_update_patch( self, resource_group_name: str, @@ -302,18 +286,24 @@ async def begin_update_patch( :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 + :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. + :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: + :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] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.MonitoringSettingResource"] lro_delay = kwargs.pop( 'polling_interval', @@ -325,27 +315,21 @@ async def begin_update_patch( resource_group_name=resource_group_name, service_name=service_name, monitoring_setting_resource=monitoring_setting_resource, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_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) + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -357,4 +341,5 @@ def get_long_running_output(pipeline_response): ) 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/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2020_07_01/aio/operations/_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2020_07_01/aio/operations/_operations.py index d114e98657ea2..6e1b9af660c60 100644 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2020_07_01/aio/operations/_operations.py +++ b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2020_07_01/aio/operations/_operations.py @@ -5,17 +5,22 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools 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.core.pipeline.transport import AsyncHttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._operations import build_list_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -41,6 +46,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace def list( self, **kwargs: Any @@ -49,7 +55,8 @@ def list( :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] + :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"] @@ -57,30 +64,27 @@ def list( 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 = build_list_request( + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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) + + request = build_list_request( + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('AvailableOperations', pipeline_response) + deserialized = self._deserialize("AvailableOperations", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -98,6 +102,7 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2020_07_01/aio/operations/_runtime_versions_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2020_07_01/aio/operations/_runtime_versions_operations.py index 1d3ccd3dbfe18..f15b543579b67 100644 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2020_07_01/aio/operations/_runtime_versions_operations.py +++ b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2020_07_01/aio/operations/_runtime_versions_operations.py @@ -5,16 +5,20 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools 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.core.pipeline.transport import AsyncHttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._runtime_versions_operations import build_list_runtime_versions_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -40,6 +44,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace_async async def list_runtime_versions( self, **kwargs: Any @@ -56,21 +61,14 @@ async def list_runtime_versions( 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 = build_list_runtime_versions_request( + template_url=self.list_runtime_versions.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -84,4 +82,6 @@ async def list_runtime_versions( return cls(pipeline_response, deserialized, {}) return deserialized + list_runtime_versions.metadata = {'url': '/providers/Microsoft.AppPlatform/runtimeVersions'} # type: ignore + diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2020_07_01/aio/operations/_services_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2020_07_01/aio/operations/_services_operations.py index 092b2ee09fc4e..d110268bc8720 100644 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2020_07_01/aio/operations/_services_operations.py +++ b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2020_07_01/aio/operations/_services_operations.py @@ -5,19 +5,24 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools 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.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._services_operations import build_check_name_availability_request, build_create_or_update_request_initial, build_delete_request_initial, build_disable_test_endpoint_request, build_enable_test_endpoint_request, build_get_request, build_list_by_subscription_request, build_list_request, build_list_test_keys_request, build_regenerate_test_key_request, build_update_request_initial T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -43,6 +48,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace_async async def get( self, resource_group_name: str, @@ -66,27 +72,17 @@ async def get( 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 = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -100,8 +96,10 @@ async def get( 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, @@ -114,32 +112,22 @@ async def _create_or_update_initial( 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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = self._serialize.body(resource, 'ServiceResource') + + request = build_create_or_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -160,8 +148,11 @@ async def _create_or_update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}'} # type: ignore + + @distributed_trace_async async def begin_create_or_update( self, resource_group_name: str, @@ -180,15 +171,20 @@ async def begin_create_or_update( :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. + :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: + :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] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.ServiceResource"] lro_delay = kwargs.pop( 'polling_interval', @@ -200,27 +196,21 @@ async def begin_create_or_update( resource_group_name=resource_group_name, service_name=service_name, resource=resource, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_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) + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -232,6 +222,7 @@ def get_long_running_output(pipeline_response): ) 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( @@ -245,27 +236,17 @@ async def _delete_initial( 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 = build_delete_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -278,6 +259,8 @@ async def _delete_initial( _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}'} # type: ignore + + @distributed_trace_async async def begin_delete( self, resource_group_name: str, @@ -293,15 +276,17 @@ async def begin_delete( :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. + :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. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -315,21 +300,14 @@ async def begin_delete( 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) + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -341,6 +319,7 @@ def get_long_running_output(pipeline_response): ) 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( @@ -355,32 +334,22 @@ async def _update_initial( 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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = self._serialize.body(resource, 'ServiceResource') + + request = build_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + content_type=content_type, + json=_json, + template_url=self._update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -398,8 +367,11 @@ async def _update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}'} # type: ignore + + @distributed_trace_async async def begin_update( self, resource_group_name: str, @@ -418,15 +390,20 @@ async def begin_update( :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. + :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: + :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] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.ServiceResource"] lro_delay = kwargs.pop( 'polling_interval', @@ -438,27 +415,21 @@ async def begin_update( resource_group_name=resource_group_name, service_name=service_name, resource=resource, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_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) + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -470,8 +441,10 @@ def get_long_running_output(pipeline_response): ) 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 + @distributed_trace_async async def list_test_keys( self, resource_group_name: str, @@ -495,27 +468,17 @@ async def list_test_keys( 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 = build_list_test_keys_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + template_url=self.list_test_keys.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -529,8 +492,11 @@ async def list_test_keys( return cls(pipeline_response, deserialized, {}) return deserialized + list_test_keys.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/listTestKeys'} # type: ignore + + @distributed_trace_async async def regenerate_test_key( self, resource_group_name: str, @@ -546,7 +512,8 @@ async def regenerate_test_key( :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 + :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 @@ -557,32 +524,22 @@ async def regenerate_test_key( 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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = self._serialize.body(regenerate_test_key_request, 'RegenerateTestKeyRequestPayload') + + request = build_regenerate_test_key_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + content_type=content_type, + json=_json, + template_url=self.regenerate_test_key.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -596,8 +553,11 @@ async def regenerate_test_key( return cls(pipeline_response, deserialized, {}) return deserialized + regenerate_test_key.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/regenerateTestKey'} # type: ignore + + @distributed_trace_async async def disable_test_endpoint( self, resource_group_name: str, @@ -621,27 +581,17 @@ async def disable_test_endpoint( 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 = build_disable_test_endpoint_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + template_url=self.disable_test_endpoint.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -654,6 +604,8 @@ async def disable_test_endpoint( disable_test_endpoint.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/disableTestEndpoint'} # type: ignore + + @distributed_trace_async async def enable_test_endpoint( self, resource_group_name: str, @@ -677,27 +629,17 @@ async def enable_test_endpoint( 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 = build_enable_test_endpoint_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + template_url=self.enable_test_endpoint.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -711,8 +653,11 @@ async def enable_test_endpoint( return cls(pipeline_response, deserialized, {}) return deserialized + enable_test_endpoint.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/enableTestEndpoint'} # type: ignore + + @distributed_trace_async async def check_name_availability( self, location: str, @@ -724,7 +669,8 @@ async def check_name_availability( :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 + :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 @@ -735,31 +681,21 @@ async def check_name_availability( 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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = self._serialize.body(availability_parameters, 'NameAvailabilityParameters') + + request = build_check_name_availability_request( + subscription_id=self._config.subscription_id, + location=location, + content_type=content_type, + json=_json, + template_url=self.check_name_availability.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -773,8 +709,11 @@ async def check_name_availability( return cls(pipeline_response, deserialized, {}) return deserialized + check_name_availability.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.AppPlatform/locations/{location}/checkNameAvailability'} # type: ignore + + @distributed_trace def list_by_subscription( self, **kwargs: Any @@ -783,7 +722,8 @@ def list_by_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] + :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"] @@ -791,34 +731,29 @@ def list_by_subscription( 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) + + request = build_list_by_subscription_request( + subscription_id=self._config.subscription_id, + template_url=self.list_by_subscription.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_subscription_request( + subscription_id=self._config.subscription_id, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('ServiceResourceList', pipeline_response) + deserialized = self._deserialize("ServiceResourceList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -836,11 +771,13 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) list_by_subscription.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.AppPlatform/Spring'} # type: ignore + @distributed_trace def list( self, resource_group_name: str, @@ -853,7 +790,8 @@ def list( :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] + :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"] @@ -861,35 +799,31 @@ def list( 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) + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('ServiceResourceList', pipeline_response) + deserialized = self._deserialize("ServiceResourceList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -907,6 +841,7 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2020_07_01/aio/operations/_skus_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2020_07_01/aio/operations/_skus_operations.py index c7de60e3a3f4c..35e1d056c03d1 100644 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2020_07_01/aio/operations/_skus_operations.py +++ b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2020_07_01/aio/operations/_skus_operations.py @@ -5,17 +5,22 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools 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.core.pipeline.transport import AsyncHttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._skus_operations import build_list_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -41,6 +46,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace def list( self, **kwargs: Any @@ -48,8 +54,10 @@ def list( """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] + :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"] @@ -57,34 +65,29 @@ def list( 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) + + request = build_list_request( + subscription_id=self._config.subscription_id, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('ResourceSkuCollection', pipeline_response) + deserialized = self._deserialize("ResourceSkuCollection", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -102,6 +105,7 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2020_07_01/models/__init__.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2020_07_01/models/__init__.py index 5659fe3dbc3d9..8ad0dccf3cd26 100644 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2020_07_01/models/__init__.py +++ b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2020_07_01/models/__init__.py @@ -146,6 +146,7 @@ from ._models import UserSourceInfo # type: ignore from ._app_platform_management_client_enums import ( + ActionType, AppResourceProvisioningState, ConfigServerState, DeploymentResourceProvisioningState, @@ -233,6 +234,7 @@ 'TestKeys', 'TrackedResource', 'UserSourceInfo', + 'ActionType', 'AppResourceProvisioningState', 'ConfigServerState', 'DeploymentResourceProvisioningState', diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2020_07_01/models/_app_platform_management_client_enums.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2020_07_01/models/_app_platform_management_client_enums.py index 5ac8dede62c02..483260921151a 100644 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2020_07_01/models/_app_platform_management_client_enums.py +++ b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2020_07_01/models/_app_platform_management_client_enums.py @@ -6,27 +6,18 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from enum import Enum, EnumMeta +from enum import Enum from six import with_metaclass +from azure.core import CaseInsensitiveEnumMeta -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 ActionType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): + """Enum. Indicates the action type. "Internal" refers to actions that are for internal only APIs. + """ + INTERNAL = "Internal" -class AppResourceProvisioningState(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class AppResourceProvisioningState(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Provisioning state of the App """ @@ -35,7 +26,7 @@ class AppResourceProvisioningState(with_metaclass(_CaseInsensitiveEnumMeta, str, CREATING = "Creating" UPDATING = "Updating" -class ConfigServerState(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class ConfigServerState(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """State of the config server. """ @@ -45,7 +36,7 @@ class ConfigServerState(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): SUCCEEDED = "Succeeded" UPDATING = "Updating" -class DeploymentResourceProvisioningState(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class DeploymentResourceProvisioningState(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Provisioning state of the Deployment """ @@ -54,7 +45,7 @@ class DeploymentResourceProvisioningState(with_metaclass(_CaseInsensitiveEnumMet SUCCEEDED = "Succeeded" FAILED = "Failed" -class DeploymentResourceStatus(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class DeploymentResourceStatus(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Status of the Deployment """ @@ -66,7 +57,7 @@ class DeploymentResourceStatus(with_metaclass(_CaseInsensitiveEnumMeta, str, Enu UPGRADING = "Upgrading" COMPILING = "Compiling" -class ManagedIdentityType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class ManagedIdentityType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Type of the managed identity """ @@ -75,7 +66,7 @@ class ManagedIdentityType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): USER_ASSIGNED = "UserAssigned" SYSTEM_ASSIGNED_USER_ASSIGNED = "SystemAssigned,UserAssigned" -class MonitoringSettingState(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class MonitoringSettingState(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """State of the Monitoring Setting. """ @@ -84,7 +75,7 @@ class MonitoringSettingState(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum) SUCCEEDED = "Succeeded" UPDATING = "Updating" -class ProvisioningState(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class ProvisioningState(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Provisioning state of the Service """ @@ -98,7 +89,7 @@ class ProvisioningState(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): MOVED = "Moved" MOVE_FAILED = "MoveFailed" -class ResourceSkuRestrictionsReasonCode(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class ResourceSkuRestrictionsReasonCode(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Gets the reason for restriction. Possible values include: 'QuotaId', 'NotAvailableForSubscription' """ @@ -106,14 +97,14 @@ class ResourceSkuRestrictionsReasonCode(with_metaclass(_CaseInsensitiveEnumMeta, QUOTA_ID = "QuotaId" NOT_AVAILABLE_FOR_SUBSCRIPTION = "NotAvailableForSubscription" -class ResourceSkuRestrictionsType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +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)): +class RuntimeVersion(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Runtime version """ @@ -121,7 +112,7 @@ class RuntimeVersion(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): JAVA11 = "Java_11" NET_CORE31 = "NetCore_31" -class SkuScaleType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class SkuScaleType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Gets or sets the type of the scale. """ @@ -129,14 +120,14 @@ class SkuScaleType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): MANUAL = "Manual" AUTOMATIC = "Automatic" -class SupportedRuntimePlatform(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +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)): +class SupportedRuntimeValue(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The raw value which could be passed to deployment CRUD operations. """ @@ -144,21 +135,21 @@ class SupportedRuntimeValue(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)) JAVA11 = "Java_11" NET_CORE31 = "NetCore_31" -class TestKeyType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class TestKeyType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Type of the test key """ PRIMARY = "Primary" SECONDARY = "Secondary" -class TrafficDirection(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class TrafficDirection(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The direction of required traffic """ INBOUND = "Inbound" OUTBOUND = "Outbound" -class UserSourceType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class UserSourceType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Type of the source uploaded """ diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2020_07_01/models/_models.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2020_07_01/models/_models.py index 10db354c88fee..7ccb903f74984 100644 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2020_07_01/models/_models.py +++ b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2020_07_01/models/_models.py @@ -38,6 +38,8 @@ def __init__( self, **kwargs ): + """ + """ super(Resource, self).__init__(**kwargs) self.id = None self.name = None @@ -73,6 +75,8 @@ def __init__( self, **kwargs ): + """ + """ super(ProxyResource, self).__init__(**kwargs) @@ -87,12 +91,12 @@ 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. - :type location: str + :ivar properties: Properties of the App resource. + :vartype properties: ~azure.mgmt.appplatform.v2020_07_01.models.AppResourceProperties + :ivar identity: The Managed Identity type of the app resource. + :vartype identity: ~azure.mgmt.appplatform.v2020_07_01.models.ManagedIdentityProperties + :ivar location: The GEO location of the application, always the same with its parent resource. + :vartype location: str """ _validation = { @@ -114,6 +118,15 @@ def __init__( self, **kwargs ): + """ + :keyword properties: Properties of the App resource. + :paramtype properties: ~azure.mgmt.appplatform.v2020_07_01.models.AppResourceProperties + :keyword identity: The Managed Identity type of the app resource. + :paramtype identity: ~azure.mgmt.appplatform.v2020_07_01.models.ManagedIdentityProperties + :keyword location: The GEO location of the application, always the same with its parent + resource. + :paramtype location: str + """ super(AppResource, self).__init__(**kwargs) self.properties = kwargs.get('properties', None) self.identity = kwargs.get('identity', None) @@ -123,11 +136,11 @@ def __init__( 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). + :ivar value: Collection of App resources. + :vartype value: list[~azure.mgmt.appplatform.v2020_07_01.models.AppResource] + :ivar 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 + :vartype next_link: str """ _attribute_map = { @@ -139,6 +152,13 @@ def __init__( self, **kwargs ): + """ + :keyword value: Collection of App resources. + :paramtype value: list[~azure.mgmt.appplatform.v2020_07_01.models.AppResource] + :keyword next_link: URL client should use to fetch the next page (per server side paging). + It's null for now, added for future use. + :paramtype next_link: str + """ super(AppResourceCollection, self).__init__(**kwargs) self.value = kwargs.get('value', None) self.next_link = kwargs.get('next_link', None) @@ -149,26 +169,26 @@ class AppResourceProperties(msrest.serialization.Model): Variables are only populated by the server, and will be ignored when sending a request. - :param public: Indicates whether the App exposes public endpoint. - :type public: bool + :ivar public: Indicates whether the App exposes public endpoint. + :vartype public: bool :ivar url: URL of the App. :vartype url: str :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. - :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 active_deployment_name: Name of the active deployment of the App. + :vartype active_deployment_name: str + :ivar fqdn: Fully qualified dns Name. + :vartype fqdn: str + :ivar https_only: Indicate if only https is allowed. + :vartype https_only: bool :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 + :ivar temporary_disk: Temporary disk settings. + :vartype temporary_disk: ~azure.mgmt.appplatform.v2020_07_01.models.TemporaryDisk + :ivar persistent_disk: Persistent disk settings. + :vartype persistent_disk: ~azure.mgmt.appplatform.v2020_07_01.models.PersistentDisk """ _validation = { @@ -193,6 +213,20 @@ def __init__( self, **kwargs ): + """ + :keyword public: Indicates whether the App exposes public endpoint. + :paramtype public: bool + :keyword active_deployment_name: Name of the active deployment of the App. + :paramtype active_deployment_name: str + :keyword fqdn: Fully qualified dns Name. + :paramtype fqdn: str + :keyword https_only: Indicate if only https is allowed. + :paramtype https_only: bool + :keyword temporary_disk: Temporary disk settings. + :paramtype temporary_disk: ~azure.mgmt.appplatform.v2020_07_01.models.TemporaryDisk + :keyword persistent_disk: Persistent disk settings. + :paramtype persistent_disk: ~azure.mgmt.appplatform.v2020_07_01.models.PersistentDisk + """ super(AppResourceProperties, self).__init__(**kwargs) self.public = kwargs.get('public', None) self.url = None @@ -208,11 +242,11 @@ def __init__( 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). + :ivar value: Collection of available operation details. + :vartype value: list[~azure.mgmt.appplatform.v2020_07_01.models.OperationDetail] + :ivar 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 + :vartype next_link: str """ _attribute_map = { @@ -224,6 +258,13 @@ def __init__( self, **kwargs ): + """ + :keyword value: Collection of available operation details. + :paramtype value: list[~azure.mgmt.appplatform.v2020_07_01.models.OperationDetail] + :keyword next_link: URL client should use to fetch the next page (per server side paging). + It's null for now, added for future use. + :paramtype next_link: str + """ super(AvailableOperations, self).__init__(**kwargs) self.value = kwargs.get('value', None) self.next_link = kwargs.get('next_link', None) @@ -250,6 +291,8 @@ def __init__( self, **kwargs ): + """ + """ super(AvailableRuntimeVersions, self).__init__(**kwargs) self.value = None @@ -265,8 +308,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 + :ivar properties: Properties of the Binding resource. + :vartype properties: ~azure.mgmt.appplatform.v2020_07_01.models.BindingResourceProperties """ _validation = { @@ -286,6 +329,10 @@ def __init__( self, **kwargs ): + """ + :keyword properties: Properties of the Binding resource. + :paramtype properties: ~azure.mgmt.appplatform.v2020_07_01.models.BindingResourceProperties + """ super(BindingResource, self).__init__(**kwargs) self.properties = kwargs.get('properties', None) @@ -293,11 +340,11 @@ def __init__( 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). + :ivar value: Collection of Binding resources. + :vartype value: list[~azure.mgmt.appplatform.v2020_07_01.models.BindingResource] + :ivar 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 + :vartype next_link: str """ _attribute_map = { @@ -309,6 +356,13 @@ def __init__( self, **kwargs ): + """ + :keyword value: Collection of Binding resources. + :paramtype value: list[~azure.mgmt.appplatform.v2020_07_01.models.BindingResource] + :keyword next_link: URL client should use to fetch the next page (per server side paging). + It's null for now, added for future use. + :paramtype next_link: str + """ super(BindingResourceCollection, self).__init__(**kwargs) self.value = kwargs.get('value', None) self.next_link = kwargs.get('next_link', None) @@ -323,12 +377,12 @@ class BindingResourceProperties(msrest.serialization.Model): :vartype resource_name: str :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. - :type resource_id: str - :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, any] + :ivar resource_id: The Azure resource id of the bound resource. + :vartype resource_id: str + :ivar key: The key of the bound resource. + :vartype key: str + :ivar binding_parameters: Binding parameters of the Binding resource. + :vartype 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 @@ -361,6 +415,14 @@ def __init__( self, **kwargs ): + """ + :keyword resource_id: The Azure resource id of the bound resource. + :paramtype resource_id: str + :keyword key: The key of the bound resource. + :paramtype key: str + :keyword binding_parameters: Binding parameters of the Binding resource. + :paramtype binding_parameters: dict[str, any] + """ super(BindingResourceProperties, self).__init__(**kwargs) self.resource_name = None self.resource_type = None @@ -381,12 +443,12 @@ class CertificateProperties(msrest.serialization.Model): :ivar thumbprint: The thumbprint of certificate. :vartype thumbprint: str - :param vault_uri: Required. The vault uri of user key vault. - :type vault_uri: str - :param key_vault_cert_name: Required. The certificate name of key vault. - :type key_vault_cert_name: str - :param cert_version: The certificate version of key vault. - :type cert_version: str + :ivar vault_uri: Required. The vault uri of user key vault. + :vartype vault_uri: str + :ivar key_vault_cert_name: Required. The certificate name of key vault. + :vartype key_vault_cert_name: str + :ivar cert_version: The certificate version of key vault. + :vartype cert_version: str :ivar issuer: The issuer of certificate. :vartype issuer: str :ivar issued_date: The issue date of certificate. @@ -430,6 +492,14 @@ def __init__( self, **kwargs ): + """ + :keyword vault_uri: Required. The vault uri of user key vault. + :paramtype vault_uri: str + :keyword key_vault_cert_name: Required. The certificate name of key vault. + :paramtype key_vault_cert_name: str + :keyword cert_version: The certificate version of key vault. + :paramtype cert_version: str + """ super(CertificateProperties, self).__init__(**kwargs) self.thumbprint = None self.vault_uri = kwargs['vault_uri'] @@ -454,8 +524,8 @@ class CertificateResource(ProxyResource): :vartype name: str :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 + :ivar properties: Properties of the certificate resource payload. + :vartype properties: ~azure.mgmt.appplatform.v2020_07_01.models.CertificateProperties """ _validation = { @@ -475,6 +545,10 @@ def __init__( self, **kwargs ): + """ + :keyword properties: Properties of the certificate resource payload. + :paramtype properties: ~azure.mgmt.appplatform.v2020_07_01.models.CertificateProperties + """ super(CertificateResource, self).__init__(**kwargs) self.properties = kwargs.get('properties', None) @@ -482,10 +556,10 @@ def __init__( class CertificateResourceCollection(msrest.serialization.Model): """Collection compose of certificate resources list and a possible link for next page. - :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 + :ivar value: The certificate resources list. + :vartype value: list[~azure.mgmt.appplatform.v2020_07_01.models.CertificateResource] + :ivar next_link: The link to next page of certificate list. + :vartype next_link: str """ _attribute_map = { @@ -497,6 +571,12 @@ def __init__( self, **kwargs ): + """ + :keyword value: The certificate resources list. + :paramtype value: list[~azure.mgmt.appplatform.v2020_07_01.models.CertificateResource] + :keyword next_link: The link to next page of certificate list. + :paramtype next_link: str + """ super(CertificateResourceCollection, self).__init__(**kwargs) self.value = kwargs.get('value', None) self.next_link = kwargs.get('next_link', None) @@ -505,17 +585,17 @@ def __init__( 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 + :ivar 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 + :vartype code: str + :ivar 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 + :vartype message: str + :ivar 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] + :vartype target: str + :ivar details: A list of additional details about the error. + :vartype details: list[~azure.mgmt.appplatform.v2020_07_01.models.CloudErrorBody] """ _attribute_map = { @@ -529,6 +609,19 @@ def __init__( self, **kwargs ): + """ + :keyword code: An identifier for the error. Codes are invariant and are intended to be consumed + programmatically. + :paramtype code: str + :keyword message: A message describing the error, intended to be suitable for display in a user + interface. + :paramtype message: str + :keyword target: The target of the particular error. For example, the name of the property in + error. + :paramtype target: str + :keyword details: A list of additional details about the error. + :paramtype details: list[~azure.mgmt.appplatform.v2020_07_01.models.CloudErrorBody] + """ super(CloudErrorBody, self).__init__(**kwargs) self.code = kwargs.get('code', None) self.message = kwargs.get('message', None) @@ -546,8 +639,8 @@ class ClusterResourceProperties(msrest.serialization.Model): "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 network_profile: Network profile of the Service. + :vartype 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. @@ -571,6 +664,10 @@ def __init__( self, **kwargs ): + """ + :keyword network_profile: Network profile of the Service. + :paramtype network_profile: ~azure.mgmt.appplatform.v2020_07_01.models.NetworkProfile + """ super(ClusterResourceProperties, self).__init__(**kwargs) self.provisioning_state = None self.network_profile = kwargs.get('network_profile', None) @@ -583,26 +680,26 @@ class ConfigServerGitProperty(msrest.serialization.Model): 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 uri: str - :param label: Label of the repository. - :type label: str - :param search_paths: Searching path of the repository. - :type search_paths: list[str] - :param username: Username of git repository basic auth. - :type username: str - :param password: Password of git repository basic auth. - :type password: str - :param host_key: Public sshKey of git repository. - :type host_key: str - :param host_key_algorithm: SshKey algorithm of git repository. - :type host_key_algorithm: str - :param private_key: Private sshKey algorithm of git repository. - :type private_key: str - :param strict_host_key_checking: Strict host key checking or not. - :type strict_host_key_checking: bool + :ivar repositories: Repositories of git. + :vartype repositories: list[~azure.mgmt.appplatform.v2020_07_01.models.GitPatternRepository] + :ivar uri: Required. URI of the repository. + :vartype uri: str + :ivar label: Label of the repository. + :vartype label: str + :ivar search_paths: Searching path of the repository. + :vartype search_paths: list[str] + :ivar username: Username of git repository basic auth. + :vartype username: str + :ivar password: Password of git repository basic auth. + :vartype password: str + :ivar host_key: Public sshKey of git repository. + :vartype host_key: str + :ivar host_key_algorithm: SshKey algorithm of git repository. + :vartype host_key_algorithm: str + :ivar private_key: Private sshKey algorithm of git repository. + :vartype private_key: str + :ivar strict_host_key_checking: Strict host key checking or not. + :vartype strict_host_key_checking: bool """ _validation = { @@ -626,6 +723,28 @@ def __init__( self, **kwargs ): + """ + :keyword repositories: Repositories of git. + :paramtype repositories: list[~azure.mgmt.appplatform.v2020_07_01.models.GitPatternRepository] + :keyword uri: Required. URI of the repository. + :paramtype uri: str + :keyword label: Label of the repository. + :paramtype label: str + :keyword search_paths: Searching path of the repository. + :paramtype search_paths: list[str] + :keyword username: Username of git repository basic auth. + :paramtype username: str + :keyword password: Password of git repository basic auth. + :paramtype password: str + :keyword host_key: Public sshKey of git repository. + :paramtype host_key: str + :keyword host_key_algorithm: SshKey algorithm of git repository. + :paramtype host_key_algorithm: str + :keyword private_key: Private sshKey algorithm of git repository. + :paramtype private_key: str + :keyword strict_host_key_checking: Strict host key checking or not. + :paramtype strict_host_key_checking: bool + """ super(ConfigServerGitProperty, self).__init__(**kwargs) self.repositories = kwargs.get('repositories', None) self.uri = kwargs['uri'] @@ -648,10 +767,10 @@ class ConfigServerProperties(msrest.serialization.Model): "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 + :ivar error: Error when apply config server settings. + :vartype error: ~azure.mgmt.appplatform.v2020_07_01.models.Error + :ivar config_server: Settings of config server. + :vartype config_server: ~azure.mgmt.appplatform.v2020_07_01.models.ConfigServerSettings """ _validation = { @@ -668,6 +787,12 @@ def __init__( self, **kwargs ): + """ + :keyword error: Error when apply config server settings. + :paramtype error: ~azure.mgmt.appplatform.v2020_07_01.models.Error + :keyword config_server: Settings of config server. + :paramtype config_server: ~azure.mgmt.appplatform.v2020_07_01.models.ConfigServerSettings + """ super(ConfigServerProperties, self).__init__(**kwargs) self.provisioning_state = None self.error = kwargs.get('error', None) @@ -685,8 +810,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 + :ivar properties: Properties of the Config Server resource. + :vartype properties: ~azure.mgmt.appplatform.v2020_07_01.models.ConfigServerProperties """ _validation = { @@ -706,6 +831,10 @@ def __init__( self, **kwargs ): + """ + :keyword properties: Properties of the Config Server resource. + :paramtype properties: ~azure.mgmt.appplatform.v2020_07_01.models.ConfigServerProperties + """ super(ConfigServerResource, self).__init__(**kwargs) self.properties = kwargs.get('properties', None) @@ -713,8 +842,8 @@ def __init__( 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 + :ivar git_property: Property of git environment. + :vartype git_property: ~azure.mgmt.appplatform.v2020_07_01.models.ConfigServerGitProperty """ _attribute_map = { @@ -725,6 +854,10 @@ def __init__( self, **kwargs ): + """ + :keyword git_property: Property of git environment. + :paramtype git_property: ~azure.mgmt.appplatform.v2020_07_01.models.ConfigServerGitProperty + """ super(ConfigServerSettings, self).__init__(**kwargs) self.git_property = kwargs.get('git_property', None) @@ -732,12 +865,12 @@ def __init__( class ConfigServerSettingsErrorRecord(msrest.serialization.Model): """Error record of the config server settings. - :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. - :type uri: str - :param messages: The detail error messages of the record. - :type messages: list[str] + :ivar name: The name of the config server settings error record. + :vartype name: str + :ivar uri: The uri of the config server settings error record. + :vartype uri: str + :ivar messages: The detail error messages of the record. + :vartype messages: list[str] """ _attribute_map = { @@ -750,6 +883,14 @@ def __init__( self, **kwargs ): + """ + :keyword name: The name of the config server settings error record. + :paramtype name: str + :keyword uri: The uri of the config server settings error record. + :paramtype uri: str + :keyword messages: The detail error messages of the record. + :paramtype messages: list[str] + """ super(ConfigServerSettingsErrorRecord, self).__init__(**kwargs) self.name = kwargs.get('name', None) self.uri = kwargs.get('uri', None) @@ -759,10 +900,11 @@ def __init__( class ConfigServerSettingsValidateResult(msrest.serialization.Model): """Validation result for config server settings. - :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] + :ivar is_valid: Indicate if the config server settings are valid. + :vartype is_valid: bool + :ivar details: The detail validation results. + :vartype details: + list[~azure.mgmt.appplatform.v2020_07_01.models.ConfigServerSettingsErrorRecord] """ _attribute_map = { @@ -774,6 +916,13 @@ def __init__( self, **kwargs ): + """ + :keyword is_valid: Indicate if the config server settings are valid. + :paramtype is_valid: bool + :keyword details: The detail validation results. + :paramtype details: + list[~azure.mgmt.appplatform.v2020_07_01.models.ConfigServerSettingsErrorRecord] + """ super(ConfigServerSettingsValidateResult, self).__init__(**kwargs) self.is_valid = kwargs.get('is_valid', None) self.details = kwargs.get('details', None) @@ -784,12 +933,12 @@ class CustomDomainProperties(msrest.serialization.Model): 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 + :ivar thumbprint: The thumbprint of bound certificate. + :vartype thumbprint: str :ivar app_name: The app name of domain. :vartype app_name: str - :param cert_name: The bound certificate name of domain. - :type cert_name: str + :ivar cert_name: The bound certificate name of domain. + :vartype cert_name: str """ _validation = { @@ -806,6 +955,12 @@ def __init__( self, **kwargs ): + """ + :keyword thumbprint: The thumbprint of bound certificate. + :paramtype thumbprint: str + :keyword cert_name: The bound certificate name of domain. + :paramtype cert_name: str + """ super(CustomDomainProperties, self).__init__(**kwargs) self.thumbprint = kwargs.get('thumbprint', None) self.app_name = None @@ -823,8 +978,8 @@ class CustomDomainResource(ProxyResource): :vartype name: str :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 + :ivar properties: Properties of the custom domain resource. + :vartype properties: ~azure.mgmt.appplatform.v2020_07_01.models.CustomDomainProperties """ _validation = { @@ -844,6 +999,10 @@ def __init__( self, **kwargs ): + """ + :keyword properties: Properties of the custom domain resource. + :paramtype properties: ~azure.mgmt.appplatform.v2020_07_01.models.CustomDomainProperties + """ super(CustomDomainResource, self).__init__(**kwargs) self.properties = kwargs.get('properties', None) @@ -851,10 +1010,10 @@ def __init__( 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 + :ivar value: The custom domain resources list. + :vartype value: list[~azure.mgmt.appplatform.v2020_07_01.models.CustomDomainResource] + :ivar next_link: The link to next page of custom domain list. + :vartype next_link: str """ _attribute_map = { @@ -866,6 +1025,12 @@ def __init__( self, **kwargs ): + """ + :keyword value: The custom domain resources list. + :paramtype value: list[~azure.mgmt.appplatform.v2020_07_01.models.CustomDomainResource] + :keyword next_link: The link to next page of custom domain list. + :paramtype next_link: str + """ super(CustomDomainResourceCollection, self).__init__(**kwargs) self.value = kwargs.get('value', None) self.next_link = kwargs.get('next_link', None) @@ -876,8 +1041,8 @@ class CustomDomainValidatePayload(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param name: Required. Name to be validated. - :type name: str + :ivar name: Required. Name to be validated. + :vartype name: str """ _validation = { @@ -892,6 +1057,10 @@ def __init__( self, **kwargs ): + """ + :keyword name: Required. Name to be validated. + :paramtype name: str + """ super(CustomDomainValidatePayload, self).__init__(**kwargs) self.name = kwargs['name'] @@ -899,10 +1068,10 @@ def __init__( class CustomDomainValidateResult(msrest.serialization.Model): """Validation result for custom domain. - :param is_valid: Indicates if domain name is valid. - :type is_valid: bool - :param message: Message of why domain name is invalid. - :type message: str + :ivar is_valid: Indicates if domain name is valid. + :vartype is_valid: bool + :ivar message: Message of why domain name is invalid. + :vartype message: str """ _attribute_map = { @@ -914,6 +1083,12 @@ def __init__( self, **kwargs ): + """ + :keyword is_valid: Indicates if domain name is valid. + :paramtype is_valid: bool + :keyword message: Message of why domain name is invalid. + :paramtype message: str + """ super(CustomDomainValidateResult, self).__init__(**kwargs) self.is_valid = kwargs.get('is_valid', None) self.message = kwargs.get('message', None) @@ -956,6 +1131,8 @@ def __init__( self, **kwargs ): + """ + """ super(DeploymentInstance, self).__init__(**kwargs) self.name = None self.status = None @@ -975,10 +1152,10 @@ 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. - :type sku: ~azure.mgmt.appplatform.v2020_07_01.models.Sku + :ivar properties: Properties of the Deployment resource. + :vartype properties: ~azure.mgmt.appplatform.v2020_07_01.models.DeploymentResourceProperties + :ivar sku: Sku of the Deployment resource. + :vartype sku: ~azure.mgmt.appplatform.v2020_07_01.models.Sku """ _validation = { @@ -999,6 +1176,12 @@ def __init__( self, **kwargs ): + """ + :keyword properties: Properties of the Deployment resource. + :paramtype properties: ~azure.mgmt.appplatform.v2020_07_01.models.DeploymentResourceProperties + :keyword sku: Sku of the Deployment resource. + :paramtype sku: ~azure.mgmt.appplatform.v2020_07_01.models.Sku + """ super(DeploymentResource, self).__init__(**kwargs) self.properties = kwargs.get('properties', None) self.sku = kwargs.get('sku', None) @@ -1007,11 +1190,11 @@ def __init__( 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). + :ivar value: Collection of Deployment resources. + :vartype value: list[~azure.mgmt.appplatform.v2020_07_01.models.DeploymentResource] + :ivar 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 + :vartype next_link: str """ _attribute_map = { @@ -1023,6 +1206,13 @@ def __init__( self, **kwargs ): + """ + :keyword value: Collection of Deployment resources. + :paramtype value: list[~azure.mgmt.appplatform.v2020_07_01.models.DeploymentResource] + :keyword next_link: URL client should use to fetch the next page (per server side paging). + It's null for now, added for future use. + :paramtype next_link: str + """ super(DeploymentResourceCollection, self).__init__(**kwargs) self.value = kwargs.get('value', None) self.next_link = kwargs.get('next_link', None) @@ -1033,12 +1223,12 @@ class DeploymentResourceProperties(msrest.serialization.Model): 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 source: Uploaded source information of the deployment. + :vartype source: ~azure.mgmt.appplatform.v2020_07_01.models.UserSourceInfo :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 deployment_settings: Deployment settings of the Deployment. + :vartype 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 @@ -1078,6 +1268,12 @@ def __init__( self, **kwargs ): + """ + :keyword source: Uploaded source information of the deployment. + :paramtype source: ~azure.mgmt.appplatform.v2020_07_01.models.UserSourceInfo + :keyword deployment_settings: Deployment settings of the Deployment. + :paramtype deployment_settings: ~azure.mgmt.appplatform.v2020_07_01.models.DeploymentSettings + """ super(DeploymentResourceProperties, self).__init__(**kwargs) self.source = kwargs.get('source', None) self.app_name = None @@ -1092,20 +1288,20 @@ def __init__( 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). - :type cpu: int - :param memory_in_gb: Required Memory size in GB, basic tier should be in range (1, 2), standard + :ivar cpu: Required CPU, basic tier should be 1, standard tier should be in range (1, 4). + :vartype cpu: int + :ivar 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. - :type jvm_options: str - :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. - :type environment_variables: dict[str, str] - :param runtime_version: Runtime version. Possible values include: "Java_8", "Java_11", + :vartype memory_in_gb: int + :ivar jvm_options: JVM parameter. + :vartype jvm_options: str + :ivar net_core_main_entry_path: The path to the .NET executable relative to zip root. + :vartype net_core_main_entry_path: str + :ivar environment_variables: Collection of environment variables. + :vartype environment_variables: dict[str, str] + :ivar 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 + :vartype runtime_version: str or ~azure.mgmt.appplatform.v2020_07_01.models.RuntimeVersion """ _attribute_map = { @@ -1121,6 +1317,22 @@ def __init__( self, **kwargs ): + """ + :keyword cpu: Required CPU, basic tier should be 1, standard tier should be in range (1, 4). + :paramtype cpu: int + :keyword memory_in_gb: Required Memory size in GB, basic tier should be in range (1, 2), + standard tier should be in range (1, 8). + :paramtype memory_in_gb: int + :keyword jvm_options: JVM parameter. + :paramtype jvm_options: str + :keyword net_core_main_entry_path: The path to the .NET executable relative to zip root. + :paramtype net_core_main_entry_path: str + :keyword environment_variables: Collection of environment variables. + :paramtype environment_variables: dict[str, str] + :keyword runtime_version: Runtime version. Possible values include: "Java_8", "Java_11", + "NetCore_31". Default value: "Java_8". + :paramtype runtime_version: str or ~azure.mgmt.appplatform.v2020_07_01.models.RuntimeVersion + """ super(DeploymentSettings, self).__init__(**kwargs) self.cpu = kwargs.get('cpu', 1) self.memory_in_gb = kwargs.get('memory_in_gb', 1) @@ -1133,10 +1345,10 @@ def __init__( class Error(msrest.serialization.Model): """The error code compose of code and message. - :param code: The code of error. - :type code: str - :param message: The message of error. - :type message: str + :ivar code: The code of error. + :vartype code: str + :ivar message: The message of error. + :vartype message: str """ _attribute_map = { @@ -1148,6 +1360,12 @@ def __init__( self, **kwargs ): + """ + :keyword code: The code of error. + :paramtype code: str + :keyword message: The message of error. + :paramtype message: str + """ super(Error, self).__init__(**kwargs) self.code = kwargs.get('code', None) self.message = kwargs.get('message', None) @@ -1158,28 +1376,28 @@ class GitPatternRepository(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param name: Required. Name of the repository. - :type name: str - :param pattern: Collection of pattern of the repository. - :type pattern: list[str] - :param uri: Required. URI of the repository. - :type uri: str - :param label: Label of the repository. - :type label: str - :param search_paths: Searching path of the repository. - :type search_paths: list[str] - :param username: Username of git repository basic auth. - :type username: str - :param password: Password of git repository basic auth. - :type password: str - :param host_key: Public sshKey of git repository. - :type host_key: str - :param host_key_algorithm: SshKey algorithm of git repository. - :type host_key_algorithm: str - :param private_key: Private sshKey algorithm of git repository. - :type private_key: str - :param strict_host_key_checking: Strict host key checking or not. - :type strict_host_key_checking: bool + :ivar name: Required. Name of the repository. + :vartype name: str + :ivar pattern: Collection of pattern of the repository. + :vartype pattern: list[str] + :ivar uri: Required. URI of the repository. + :vartype uri: str + :ivar label: Label of the repository. + :vartype label: str + :ivar search_paths: Searching path of the repository. + :vartype search_paths: list[str] + :ivar username: Username of git repository basic auth. + :vartype username: str + :ivar password: Password of git repository basic auth. + :vartype password: str + :ivar host_key: Public sshKey of git repository. + :vartype host_key: str + :ivar host_key_algorithm: SshKey algorithm of git repository. + :vartype host_key_algorithm: str + :ivar private_key: Private sshKey algorithm of git repository. + :vartype private_key: str + :ivar strict_host_key_checking: Strict host key checking or not. + :vartype strict_host_key_checking: bool """ _validation = { @@ -1205,6 +1423,30 @@ def __init__( self, **kwargs ): + """ + :keyword name: Required. Name of the repository. + :paramtype name: str + :keyword pattern: Collection of pattern of the repository. + :paramtype pattern: list[str] + :keyword uri: Required. URI of the repository. + :paramtype uri: str + :keyword label: Label of the repository. + :paramtype label: str + :keyword search_paths: Searching path of the repository. + :paramtype search_paths: list[str] + :keyword username: Username of git repository basic auth. + :paramtype username: str + :keyword password: Password of git repository basic auth. + :paramtype password: str + :keyword host_key: Public sshKey of git repository. + :paramtype host_key: str + :keyword host_key_algorithm: SshKey algorithm of git repository. + :paramtype host_key_algorithm: str + :keyword private_key: Private sshKey algorithm of git repository. + :paramtype private_key: str + :keyword strict_host_key_checking: Strict host key checking or not. + :paramtype strict_host_key_checking: bool + """ super(GitPatternRepository, self).__init__(**kwargs) self.name = kwargs['name'] self.pattern = kwargs.get('pattern', None) @@ -1224,8 +1466,8 @@ class LogFileUrlResponse(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param url: Required. URL of the log file. - :type url: str + :ivar url: Required. URL of the log file. + :vartype url: str """ _validation = { @@ -1240,6 +1482,10 @@ def __init__( self, **kwargs ): + """ + :keyword url: Required. URL of the log file. + :paramtype url: str + """ super(LogFileUrlResponse, self).__init__(**kwargs) self.url = kwargs['url'] @@ -1247,12 +1493,12 @@ def __init__( class LogSpecification(msrest.serialization.Model): """Specifications of the Log for Azure Monitoring. - :param name: Name of the log. - :type name: str - :param display_name: Localized friendly display name of the log. - :type display_name: str - :param blob_duration: Blob duration of the log. - :type blob_duration: str + :ivar name: Name of the log. + :vartype name: str + :ivar display_name: Localized friendly display name of the log. + :vartype display_name: str + :ivar blob_duration: Blob duration of the log. + :vartype blob_duration: str """ _attribute_map = { @@ -1265,6 +1511,14 @@ def __init__( self, **kwargs ): + """ + :keyword name: Name of the log. + :paramtype name: str + :keyword display_name: Localized friendly display name of the log. + :paramtype display_name: str + :keyword blob_duration: Blob duration of the log. + :paramtype blob_duration: str + """ super(LogSpecification, self).__init__(**kwargs) self.name = kwargs.get('name', None) self.display_name = kwargs.get('display_name', None) @@ -1274,13 +1528,13 @@ def __init__( 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", + :ivar 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. - :type tenant_id: str + :vartype type: str or ~azure.mgmt.appplatform.v2020_07_01.models.ManagedIdentityType + :ivar principal_id: Principal Id. + :vartype principal_id: str + :ivar tenant_id: Tenant Id. + :vartype tenant_id: str """ _attribute_map = { @@ -1293,6 +1547,15 @@ def __init__( self, **kwargs ): + """ + :keyword type: Type of the managed identity. Possible values include: "None", "SystemAssigned", + "UserAssigned", "SystemAssigned,UserAssigned". + :paramtype type: str or ~azure.mgmt.appplatform.v2020_07_01.models.ManagedIdentityType + :keyword principal_id: Principal Id. + :paramtype principal_id: str + :keyword tenant_id: Tenant Id. + :paramtype tenant_id: str + """ super(ManagedIdentityProperties, self).__init__(**kwargs) self.type = kwargs.get('type', None) self.principal_id = kwargs.get('principal_id', None) @@ -1302,13 +1565,13 @@ def __init__( class MetricDimension(msrest.serialization.Model): """Specifications of the Dimension of metrics. - :param name: Name of the dimension. - :type name: str - :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 + :ivar name: Name of the dimension. + :vartype name: str + :ivar display_name: Localized friendly display name of the dimension. + :vartype display_name: str + :ivar to_be_exported_for_shoebox: Whether this dimension should be included for the Shoebox export scenario. - :type to_be_exported_for_shoebox: bool + :vartype to_be_exported_for_shoebox: bool """ _attribute_map = { @@ -1321,6 +1584,15 @@ def __init__( self, **kwargs ): + """ + :keyword name: Name of the dimension. + :paramtype name: str + :keyword display_name: Localized friendly display name of the dimension. + :paramtype display_name: str + :keyword to_be_exported_for_shoebox: Whether this dimension should be included for the Shoebox + export scenario. + :paramtype to_be_exported_for_shoebox: bool + """ super(MetricDimension, self).__init__(**kwargs) self.name = kwargs.get('name', None) self.display_name = kwargs.get('display_name', None) @@ -1330,29 +1602,31 @@ def __init__( class MetricSpecification(msrest.serialization.Model): """Specifications of the Metrics for Azure Monitoring. - :param name: Name of the metric. - :type name: str - :param display_name: Localized friendly display name of the metric. - :type display_name: str - :param display_description: Localized friendly description of the metric. - :type display_description: str - :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 + :ivar name: Name of the metric. + :vartype name: str + :ivar display_name: Localized friendly display name of the metric. + :vartype display_name: str + :ivar display_description: Localized friendly description of the metric. + :vartype display_description: str + :ivar unit: Unit that makes sense for the metric. + :vartype unit: str + :ivar 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, + :vartype category: str + :ivar 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. - :type supported_aggregation_types: list[str] - :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 + :vartype aggregation_type: str + :ivar supported_aggregation_types: Supported aggregation types. + :vartype supported_aggregation_types: list[str] + :ivar supported_time_grain_types: Supported time grain types. + :vartype supported_time_grain_types: list[str] + :ivar 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] + :vartype fill_gap_with_zero: bool + :ivar dimensions: Dimensions of the metric. + :vartype dimensions: list[~azure.mgmt.appplatform.v2020_07_01.models.MetricDimension] + :ivar source_mdm_namespace: Name of the MDM namespace. Optional. + :vartype source_mdm_namespace: str """ _attribute_map = { @@ -1366,12 +1640,40 @@ class MetricSpecification(msrest.serialization.Model): 'supported_time_grain_types': {'key': 'supportedTimeGrainTypes', 'type': '[str]'}, 'fill_gap_with_zero': {'key': 'fillGapWithZero', 'type': 'bool'}, 'dimensions': {'key': 'dimensions', 'type': '[MetricDimension]'}, - } - - def __init__( - self, - **kwargs - ): + 'source_mdm_namespace': {'key': 'sourceMdmNamespace', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + """ + :keyword name: Name of the metric. + :paramtype name: str + :keyword display_name: Localized friendly display name of the metric. + :paramtype display_name: str + :keyword display_description: Localized friendly description of the metric. + :paramtype display_description: str + :keyword unit: Unit that makes sense for the metric. + :paramtype unit: str + :keyword category: Name of the metric category that the metric belongs to. A metric can only + belong to a single category. + :paramtype category: str + :keyword aggregation_type: Only provide one value for this field. Valid values: Average, + Minimum, Maximum, Total, Count. + :paramtype aggregation_type: str + :keyword supported_aggregation_types: Supported aggregation types. + :paramtype supported_aggregation_types: list[str] + :keyword supported_time_grain_types: Supported time grain types. + :paramtype supported_time_grain_types: list[str] + :keyword fill_gap_with_zero: Optional. If set to true, then zero will be returned for time + duration where no metric is emitted/published. + :paramtype fill_gap_with_zero: bool + :keyword dimensions: Dimensions of the metric. + :paramtype dimensions: list[~azure.mgmt.appplatform.v2020_07_01.models.MetricDimension] + :keyword source_mdm_namespace: Name of the MDM namespace. Optional. + :paramtype source_mdm_namespace: str + """ super(MetricSpecification, self).__init__(**kwargs) self.name = kwargs.get('name', None) self.display_name = kwargs.get('display_name', None) @@ -1383,6 +1685,7 @@ def __init__( self.supported_time_grain_types = kwargs.get('supported_time_grain_types', None) self.fill_gap_with_zero = kwargs.get('fill_gap_with_zero', None) self.dimensions = kwargs.get('dimensions', None) + self.source_mdm_namespace = kwargs.get('source_mdm_namespace', None) class MonitoringSettingProperties(msrest.serialization.Model): @@ -1394,12 +1697,12 @@ class MonitoringSettingProperties(msrest.serialization.Model): "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. - :type trace_enabled: bool - :param app_insights_instrumentation_key: Target application insight instrumentation key. - :type app_insights_instrumentation_key: str + :ivar error: Error when apply Monitoring Setting changes. + :vartype error: ~azure.mgmt.appplatform.v2020_07_01.models.Error + :ivar trace_enabled: Indicates whether enable the trace functionality. + :vartype trace_enabled: bool + :ivar app_insights_instrumentation_key: Target application insight instrumentation key. + :vartype app_insights_instrumentation_key: str """ _validation = { @@ -1417,6 +1720,14 @@ def __init__( self, **kwargs ): + """ + :keyword error: Error when apply Monitoring Setting changes. + :paramtype error: ~azure.mgmt.appplatform.v2020_07_01.models.Error + :keyword trace_enabled: Indicates whether enable the trace functionality. + :paramtype trace_enabled: bool + :keyword app_insights_instrumentation_key: Target application insight instrumentation key. + :paramtype app_insights_instrumentation_key: str + """ super(MonitoringSettingProperties, self).__init__(**kwargs) self.provisioning_state = None self.error = kwargs.get('error', None) @@ -1435,8 +1746,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 + :ivar properties: Properties of the Monitoring Setting resource. + :vartype properties: ~azure.mgmt.appplatform.v2020_07_01.models.MonitoringSettingProperties """ _validation = { @@ -1456,6 +1767,10 @@ def __init__( self, **kwargs ): + """ + :keyword properties: Properties of the Monitoring Setting resource. + :paramtype properties: ~azure.mgmt.appplatform.v2020_07_01.models.MonitoringSettingProperties + """ super(MonitoringSettingResource, self).__init__(**kwargs) self.properties = kwargs.get('properties', None) @@ -1463,12 +1778,12 @@ def __init__( class NameAvailability(msrest.serialization.Model): """Name availability result payload. - :param name_available: Indicates whether the name is available. - :type name_available: bool - :param reason: Reason why the name is not available. - :type reason: str - :param message: Message why the name is not available. - :type message: str + :ivar name_available: Indicates whether the name is available. + :vartype name_available: bool + :ivar reason: Reason why the name is not available. + :vartype reason: str + :ivar message: Message why the name is not available. + :vartype message: str """ _attribute_map = { @@ -1481,6 +1796,14 @@ def __init__( self, **kwargs ): + """ + :keyword name_available: Indicates whether the name is available. + :paramtype name_available: bool + :keyword reason: Reason why the name is not available. + :paramtype reason: str + :keyword message: Message why the name is not available. + :paramtype message: str + """ super(NameAvailability, self).__init__(**kwargs) self.name_available = kwargs.get('name_available', None) self.reason = kwargs.get('reason', None) @@ -1492,10 +1815,10 @@ class NameAvailabilityParameters(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param type: Required. Type of the resource to check name availability. - :type type: str - :param name: Required. Name to be checked. - :type name: str + :ivar type: Required. Type of the resource to check name availability. + :vartype type: str + :ivar name: Required. Name to be checked. + :vartype name: str """ _validation = { @@ -1512,6 +1835,12 @@ def __init__( self, **kwargs ): + """ + :keyword type: Required. Type of the resource to check name availability. + :paramtype type: str + :keyword name: Required. Name to be checked. + :paramtype name: str + """ super(NameAvailabilityParameters, self).__init__(**kwargs) self.type = kwargs['type'] self.name = kwargs['name'] @@ -1522,20 +1851,19 @@ class NetworkProfile(msrest.serialization.Model): 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. - :type service_runtime_subnet_id: str - :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. - :type service_cidr: str - :param service_runtime_network_resource_group: Name of the resource group containing network + :ivar service_runtime_subnet_id: Fully qualified resource Id of the subnet to host Azure Spring + Cloud Service Runtime. + :vartype service_runtime_subnet_id: str + :ivar app_subnet_id: Fully qualified resource Id of the subnet to host Azure Spring Cloud Apps. + :vartype app_subnet_id: str + :ivar service_cidr: Azure Spring Cloud service reserved CIDR. + :vartype service_cidr: str + :ivar 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 + :vartype service_runtime_network_resource_group: str + :ivar app_network_resource_group: Name of the resource group containing network resources of Azure Spring Cloud Apps. - :type app_network_resource_group: str + :vartype app_network_resource_group: str :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. @@ -1561,6 +1889,22 @@ def __init__( self, **kwargs ): + """ + :keyword service_runtime_subnet_id: Fully qualified resource Id of the subnet to host Azure + Spring Cloud Service Runtime. + :paramtype service_runtime_subnet_id: str + :keyword app_subnet_id: Fully qualified resource Id of the subnet to host Azure Spring Cloud + Apps. + :paramtype app_subnet_id: str + :keyword service_cidr: Azure Spring Cloud service reserved CIDR. + :paramtype service_cidr: str + :keyword service_runtime_network_resource_group: Name of the resource group containing network + resources of Azure Spring Cloud Service Runtime. + :paramtype service_runtime_network_resource_group: str + :keyword app_network_resource_group: Name of the resource group containing network resources of + Azure Spring Cloud Apps. + :paramtype app_network_resource_group: str + """ 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) @@ -1592,6 +1936,8 @@ def __init__( self, **kwargs ): + """ + """ super(NetworkProfileOutboundIPs, self).__init__(**kwargs) self.public_i_ps = None @@ -1599,22 +1945,32 @@ def __init__( class OperationDetail(msrest.serialization.Model): """Operation detail payload. - :param name: Name of the operation. - :type name: str - :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_07_01.models.OperationDisplay - :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 + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar name: Name of the operation. + :vartype name: str + :ivar is_data_action: Indicates whether the operation is a data action. + :vartype is_data_action: bool + :ivar display: Display of the operation. + :vartype display: ~azure.mgmt.appplatform.v2020_07_01.models.OperationDisplay + :ivar action_type: Enum. Indicates the action type. "Internal" refers to actions that are for + internal only APIs. Possible values include: "Internal". + :vartype action_type: str or ~azure.mgmt.appplatform.v2020_07_01.models.ActionType + :ivar origin: Origin of the operation. + :vartype origin: str + :ivar properties: Properties of the operation. + :vartype properties: ~azure.mgmt.appplatform.v2020_07_01.models.OperationProperties """ + _validation = { + 'action_type': {'readonly': True}, + } + _attribute_map = { 'name': {'key': 'name', 'type': 'str'}, 'is_data_action': {'key': 'isDataAction', 'type': 'bool'}, 'display': {'key': 'display', 'type': 'OperationDisplay'}, + 'action_type': {'key': 'actionType', 'type': 'str'}, 'origin': {'key': 'origin', 'type': 'str'}, 'properties': {'key': 'properties', 'type': 'OperationProperties'}, } @@ -1623,10 +1979,23 @@ def __init__( self, **kwargs ): + """ + :keyword name: Name of the operation. + :paramtype name: str + :keyword is_data_action: Indicates whether the operation is a data action. + :paramtype is_data_action: bool + :keyword display: Display of the operation. + :paramtype display: ~azure.mgmt.appplatform.v2020_07_01.models.OperationDisplay + :keyword origin: Origin of the operation. + :paramtype origin: str + :keyword properties: Properties of the operation. + :paramtype properties: ~azure.mgmt.appplatform.v2020_07_01.models.OperationProperties + """ super(OperationDetail, self).__init__(**kwargs) self.name = kwargs.get('name', None) self.is_data_action = kwargs.get('is_data_action', None) self.display = kwargs.get('display', None) + self.action_type = None self.origin = kwargs.get('origin', None) self.properties = kwargs.get('properties', None) @@ -1634,14 +2003,14 @@ def __init__( class OperationDisplay(msrest.serialization.Model): """Operation display payload. - :param provider: Resource provider of the operation. - :type provider: str - :param resource: Resource of the operation. - :type resource: str - :param operation: Localized friendly name for the operation. - :type operation: str - :param description: Localized friendly description for the operation. - :type description: str + :ivar provider: Resource provider of the operation. + :vartype provider: str + :ivar resource: Resource of the operation. + :vartype resource: str + :ivar operation: Localized friendly name for the operation. + :vartype operation: str + :ivar description: Localized friendly description for the operation. + :vartype description: str """ _attribute_map = { @@ -1655,6 +2024,16 @@ def __init__( self, **kwargs ): + """ + :keyword provider: Resource provider of the operation. + :paramtype provider: str + :keyword resource: Resource of the operation. + :paramtype resource: str + :keyword operation: Localized friendly name for the operation. + :paramtype operation: str + :keyword description: Localized friendly description for the operation. + :paramtype description: str + """ super(OperationDisplay, self).__init__(**kwargs) self.provider = kwargs.get('provider', None) self.resource = kwargs.get('resource', None) @@ -1665,8 +2044,8 @@ def __init__( 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 + :ivar service_specification: Service specifications of the operation. + :vartype service_specification: ~azure.mgmt.appplatform.v2020_07_01.models.ServiceSpecification """ _attribute_map = { @@ -1677,6 +2056,11 @@ def __init__( self, **kwargs ): + """ + :keyword service_specification: Service specifications of the operation. + :paramtype service_specification: + ~azure.mgmt.appplatform.v2020_07_01.models.ServiceSpecification + """ super(OperationProperties, self).__init__(**kwargs) self.service_specification = kwargs.get('service_specification', None) @@ -1686,12 +2070,12 @@ class PersistentDisk(msrest.serialization.Model): 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. - :type size_in_gb: int + :ivar size_in_gb: Size of the persistent disk in GB. + :vartype size_in_gb: int :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. - :type mount_path: str + :ivar mount_path: Mount path of the persistent disk. + :vartype mount_path: str """ _validation = { @@ -1709,6 +2093,12 @@ def __init__( self, **kwargs ): + """ + :keyword size_in_gb: Size of the persistent disk in GB. + :paramtype size_in_gb: int + :keyword mount_path: Mount path of the persistent disk. + :paramtype mount_path: str + """ super(PersistentDisk, self).__init__(**kwargs) self.size_in_gb = kwargs.get('size_in_gb', None) self.used_in_gb = None @@ -1720,9 +2110,9 @@ class RegenerateTestKeyRequestPayload(msrest.serialization.Model): 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", + :ivar 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 + :vartype key_type: str or ~azure.mgmt.appplatform.v2020_07_01.models.TestKeyType """ _validation = { @@ -1737,6 +2127,11 @@ def __init__( self, **kwargs ): + """ + :keyword key_type: Required. Type of the test key. Possible values include: "Primary", + "Secondary". + :paramtype key_type: str or ~azure.mgmt.appplatform.v2020_07_01.models.TestKeyType + """ super(RegenerateTestKeyRequestPayload, self).__init__(**kwargs) self.key_type = kwargs['key_type'] @@ -1779,6 +2174,8 @@ def __init__( self, **kwargs ): + """ + """ super(RequiredTraffic, self).__init__(**kwargs) self.protocol = None self.port = None @@ -1790,22 +2187,23 @@ def __init__( class ResourceSku(msrest.serialization.Model): """Describes an available Azure Spring Cloud SKU. - :param resource_type: Gets the type of resource the SKU applies to. - :type resource_type: str - :param name: Gets the name of SKU. - :type name: str - :param tier: Gets the tier of SKU. - :type tier: str - :param capacity: Gets the capacity of SKU. - :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 + :ivar resource_type: Gets the type of resource the SKU applies to. + :vartype resource_type: str + :ivar name: Gets the name of SKU. + :vartype name: str + :ivar tier: Gets the tier of SKU. + :vartype tier: str + :ivar capacity: Gets the capacity of SKU. + :vartype capacity: ~azure.mgmt.appplatform.v2020_07_01.models.SkuCapacity + :ivar locations: Gets the set of locations that the SKU is available. + :vartype locations: list[str] + :ivar 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 + :vartype location_info: + list[~azure.mgmt.appplatform.v2020_07_01.models.ResourceSkuLocationInfo] + :ivar 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] + :vartype restrictions: list[~azure.mgmt.appplatform.v2020_07_01.models.ResourceSkuRestrictions] """ _attribute_map = { @@ -1822,6 +2220,26 @@ def __init__( self, **kwargs ): + """ + :keyword resource_type: Gets the type of resource the SKU applies to. + :paramtype resource_type: str + :keyword name: Gets the name of SKU. + :paramtype name: str + :keyword tier: Gets the tier of SKU. + :paramtype tier: str + :keyword capacity: Gets the capacity of SKU. + :paramtype capacity: ~azure.mgmt.appplatform.v2020_07_01.models.SkuCapacity + :keyword locations: Gets the set of locations that the SKU is available. + :paramtype locations: list[str] + :keyword location_info: Gets a list of locations and availability zones in those locations + where the SKU is available. + :paramtype location_info: + list[~azure.mgmt.appplatform.v2020_07_01.models.ResourceSkuLocationInfo] + :keyword restrictions: Gets the restrictions because of which SKU cannot be used. This is + empty if there are no restrictions. + :paramtype restrictions: + list[~azure.mgmt.appplatform.v2020_07_01.models.ResourceSkuRestrictions] + """ super(ResourceSku, self).__init__(**kwargs) self.resource_type = kwargs.get('resource_type', None) self.name = kwargs.get('name', None) @@ -1835,10 +2253,10 @@ def __init__( class ResourceSkuCapabilities(msrest.serialization.Model): """ResourceSkuCapabilities. - :param name: Gets an invariant to describe the feature. - :type name: str - :param value: Gets an invariant if the feature is measured by quantity. - :type value: str + :ivar name: Gets an invariant to describe the feature. + :vartype name: str + :ivar value: Gets an invariant if the feature is measured by quantity. + :vartype value: str """ _attribute_map = { @@ -1850,6 +2268,12 @@ def __init__( self, **kwargs ): + """ + :keyword name: Gets an invariant to describe the feature. + :paramtype name: str + :keyword value: Gets an invariant if the feature is measured by quantity. + :paramtype value: str + """ super(ResourceSkuCapabilities, self).__init__(**kwargs) self.name = kwargs.get('name', None) self.value = kwargs.get('value', None) @@ -1858,11 +2282,11 @@ def __init__( 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). + :ivar value: Collection of resource SKU. + :vartype value: list[~azure.mgmt.appplatform.v2020_07_01.models.ResourceSku] + :ivar 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 + :vartype next_link: str """ _attribute_map = { @@ -1874,6 +2298,13 @@ def __init__( self, **kwargs ): + """ + :keyword value: Collection of resource SKU. + :paramtype value: list[~azure.mgmt.appplatform.v2020_07_01.models.ResourceSku] + :keyword next_link: URL client should use to fetch the next page (per server side paging). + It's null for now, added for future use. + :paramtype next_link: str + """ super(ResourceSkuCollection, self).__init__(**kwargs) self.value = kwargs.get('value', None) self.next_link = kwargs.get('next_link', None) @@ -1882,12 +2313,12 @@ def __init__( class ResourceSkuLocationInfo(msrest.serialization.Model): """Locations and availability zones where the SKU is available. - :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] + :ivar location: Gets location of the SKU. + :vartype location: str + :ivar zones: Gets list of availability zones where the SKU is supported. + :vartype zones: list[str] + :ivar zone_details: Gets details of capabilities available to a SKU in specific zones. + :vartype zone_details: list[~azure.mgmt.appplatform.v2020_07_01.models.ResourceSkuZoneDetails] """ _attribute_map = { @@ -1900,6 +2331,15 @@ def __init__( self, **kwargs ): + """ + :keyword location: Gets location of the SKU. + :paramtype location: str + :keyword zones: Gets list of availability zones where the SKU is supported. + :paramtype zones: list[str] + :keyword zone_details: Gets details of capabilities available to a SKU in specific zones. + :paramtype zone_details: + list[~azure.mgmt.appplatform.v2020_07_01.models.ResourceSkuZoneDetails] + """ super(ResourceSkuLocationInfo, self).__init__(**kwargs) self.location = kwargs.get('location', None) self.zones = kwargs.get('zones', None) @@ -1909,10 +2349,10 @@ def __init__( class ResourceSkuRestrictionInfo(msrest.serialization.Model): """Information about the restriction where the SKU cannot be used. - :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] + :ivar locations: Gets locations where the SKU is restricted. + :vartype locations: list[str] + :ivar zones: Gets list of availability zones where the SKU is restricted. + :vartype zones: list[str] """ _attribute_map = { @@ -1924,6 +2364,12 @@ def __init__( self, **kwargs ): + """ + :keyword locations: Gets locations where the SKU is restricted. + :paramtype locations: list[str] + :keyword zones: Gets list of availability zones where the SKU is restricted. + :paramtype zones: list[str] + """ super(ResourceSkuRestrictionInfo, self).__init__(**kwargs) self.locations = kwargs.get('locations', None) self.zones = kwargs.get('zones', None) @@ -1932,19 +2378,20 @@ def __init__( class ResourceSkuRestrictions(msrest.serialization.Model): """Restrictions where the SKU cannot be used. - :param type: Gets the type of restrictions. Possible values include: 'Location', 'Zone'. + :ivar 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 + :vartype type: str or ~azure.mgmt.appplatform.v2020_07_01.models.ResourceSkuRestrictionsType + :ivar 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 + :vartype values: list[str] + :ivar 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', + :vartype restriction_info: + ~azure.mgmt.appplatform.v2020_07_01.models.ResourceSkuRestrictionInfo + :ivar reason_code: Gets the reason for restriction. Possible values include: 'QuotaId', 'NotAvailableForSubscription'. Possible values include: "QuotaId", "NotAvailableForSubscription". - :type reason_code: str or + :vartype reason_code: str or ~azure.mgmt.appplatform.v2020_07_01.models.ResourceSkuRestrictionsReasonCode """ @@ -1959,6 +2406,23 @@ def __init__( self, **kwargs ): + """ + :keyword type: Gets the type of restrictions. Possible values include: 'Location', 'Zone'. + Possible values include: "Location", "Zone". + :paramtype type: str or ~azure.mgmt.appplatform.v2020_07_01.models.ResourceSkuRestrictionsType + :keyword values: Gets the value of restrictions. If the restriction type is set to + location. This would be different locations where the SKU is restricted. + :paramtype values: list[str] + :keyword restriction_info: Gets the information about the restriction where the SKU cannot be + used. + :paramtype restriction_info: + ~azure.mgmt.appplatform.v2020_07_01.models.ResourceSkuRestrictionInfo + :keyword reason_code: Gets the reason for restriction. Possible values include: 'QuotaId', + 'NotAvailableForSubscription'. Possible values include: "QuotaId", + "NotAvailableForSubscription". + :paramtype reason_code: str or + ~azure.mgmt.appplatform.v2020_07_01.models.ResourceSkuRestrictionsReasonCode + """ super(ResourceSkuRestrictions, self).__init__(**kwargs) self.type = kwargs.get('type', None) self.values = kwargs.get('values', None) @@ -1969,12 +2433,12 @@ def __init__( 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 + :ivar 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 + :vartype name: list[str] + :ivar 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] + :vartype capabilities: list[~azure.mgmt.appplatform.v2020_07_01.models.ResourceSkuCapabilities] """ _attribute_map = { @@ -1986,6 +2450,15 @@ def __init__( self, **kwargs ): + """ + :keyword name: Gets the set of zones that the SKU is available in with the + specified capabilities. + :paramtype name: list[str] + :keyword capabilities: Gets a list of capabilities that are available for the SKU in the + specified list of zones. + :paramtype capabilities: + list[~azure.mgmt.appplatform.v2020_07_01.models.ResourceSkuCapabilities] + """ super(ResourceSkuZoneDetails, self).__init__(**kwargs) self.name = kwargs.get('name', None) self.capabilities = kwargs.get('capabilities', None) @@ -1994,10 +2467,10 @@ def __init__( class ResourceUploadDefinition(msrest.serialization.Model): """Resource upload definition payload. - :param relative_path: Source relative path. - :type relative_path: str - :param upload_url: Upload URL. - :type upload_url: str + :ivar relative_path: Source relative path. + :vartype relative_path: str + :ivar upload_url: Upload URL. + :vartype upload_url: str """ _attribute_map = { @@ -2009,6 +2482,12 @@ def __init__( self, **kwargs ): + """ + :keyword relative_path: Source relative path. + :paramtype relative_path: str + :keyword upload_url: Upload URL. + :paramtype upload_url: str + """ super(ResourceUploadDefinition, self).__init__(**kwargs) self.relative_path = kwargs.get('relative_path', None) self.upload_url = kwargs.get('upload_url', None) @@ -2025,11 +2504,11 @@ class TrackedResource(Resource): :vartype name: str :ivar type: The type of the resource. :vartype type: str - :param location: The GEO location of the resource. - :type location: str - :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] + :ivar location: The GEO location of the resource. + :vartype location: str + :ivar tags: A set of tags. Tags of the service which is a list of key value pairs that describe + the resource. + :vartype tags: dict[str, str] """ _validation = { @@ -2050,6 +2529,13 @@ def __init__( self, **kwargs ): + """ + :keyword location: The GEO location of the resource. + :paramtype location: str + :keyword tags: A set of tags. Tags of the service which is a list of key value pairs that + describe the resource. + :paramtype tags: dict[str, str] + """ super(TrackedResource, self).__init__(**kwargs) self.location = kwargs.get('location', None) self.tags = kwargs.get('tags', None) @@ -2066,15 +2552,15 @@ class ServiceResource(TrackedResource): :vartype name: str :ivar type: The type of the resource. :vartype type: str - :param location: The GEO location of the resource. - :type location: str - :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. - :type sku: ~azure.mgmt.appplatform.v2020_07_01.models.Sku + :ivar location: The GEO location of the resource. + :vartype location: str + :ivar tags: A set of tags. Tags of the service which is a list of key value pairs that describe + the resource. + :vartype tags: dict[str, str] + :ivar properties: Properties of the Service resource. + :vartype properties: ~azure.mgmt.appplatform.v2020_07_01.models.ClusterResourceProperties + :ivar sku: Sku of the Service resource. + :vartype sku: ~azure.mgmt.appplatform.v2020_07_01.models.Sku """ _validation = { @@ -2097,6 +2583,17 @@ def __init__( self, **kwargs ): + """ + :keyword location: The GEO location of the resource. + :paramtype location: str + :keyword tags: A set of tags. Tags of the service which is a list of key value pairs that + describe the resource. + :paramtype tags: dict[str, str] + :keyword properties: Properties of the Service resource. + :paramtype properties: ~azure.mgmt.appplatform.v2020_07_01.models.ClusterResourceProperties + :keyword sku: Sku of the Service resource. + :paramtype sku: ~azure.mgmt.appplatform.v2020_07_01.models.Sku + """ super(ServiceResource, self).__init__(**kwargs) self.properties = kwargs.get('properties', None) self.sku = kwargs.get('sku', None) @@ -2105,11 +2602,11 @@ def __init__( 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). + :ivar value: Collection of Service resources. + :vartype value: list[~azure.mgmt.appplatform.v2020_07_01.models.ServiceResource] + :ivar 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 + :vartype next_link: str """ _attribute_map = { @@ -2121,6 +2618,13 @@ def __init__( self, **kwargs ): + """ + :keyword value: Collection of Service resources. + :paramtype value: list[~azure.mgmt.appplatform.v2020_07_01.models.ServiceResource] + :keyword next_link: URL client should use to fetch the next page (per server side paging). + It's null for now, added for future use. + :paramtype next_link: str + """ super(ServiceResourceList, self).__init__(**kwargs) self.value = kwargs.get('value', None) self.next_link = kwargs.get('next_link', None) @@ -2129,10 +2633,10 @@ def __init__( 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. - :type metric_specifications: + :ivar log_specifications: Specifications of the Log for Azure Monitoring. + :vartype log_specifications: list[~azure.mgmt.appplatform.v2020_07_01.models.LogSpecification] + :ivar metric_specifications: Specifications of the Metrics for Azure Monitoring. + :vartype metric_specifications: list[~azure.mgmt.appplatform.v2020_07_01.models.MetricSpecification] """ @@ -2145,6 +2649,14 @@ def __init__( self, **kwargs ): + """ + :keyword log_specifications: Specifications of the Log for Azure Monitoring. + :paramtype log_specifications: + list[~azure.mgmt.appplatform.v2020_07_01.models.LogSpecification] + :keyword metric_specifications: Specifications of the Metrics for Azure Monitoring. + :paramtype metric_specifications: + list[~azure.mgmt.appplatform.v2020_07_01.models.MetricSpecification] + """ super(ServiceSpecification, self).__init__(**kwargs) self.log_specifications = kwargs.get('log_specifications', None) self.metric_specifications = kwargs.get('metric_specifications', None) @@ -2153,12 +2665,12 @@ def __init__( class Sku(msrest.serialization.Model): """Sku of Azure Spring Cloud. - :param name: Name of the Sku. - :type name: str - :param tier: Tier of the Sku. - :type tier: str - :param capacity: Current capacity of the target resource. - :type capacity: int + :ivar name: Name of the Sku. + :vartype name: str + :ivar tier: Tier of the Sku. + :vartype tier: str + :ivar capacity: Current capacity of the target resource. + :vartype capacity: int """ _attribute_map = { @@ -2171,6 +2683,14 @@ def __init__( self, **kwargs ): + """ + :keyword name: Name of the Sku. + :paramtype name: str + :keyword tier: Tier of the Sku. + :paramtype tier: str + :keyword capacity: Current capacity of the target resource. + :paramtype capacity: int + """ super(Sku, self).__init__(**kwargs) self.name = kwargs.get('name', None) self.tier = kwargs.get('tier', None) @@ -2182,15 +2702,15 @@ class SkuCapacity(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param minimum: Required. Gets or sets the minimum. - :type minimum: int - :param maximum: Gets or sets the maximum. - :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", + :ivar minimum: Required. Gets or sets the minimum. + :vartype minimum: int + :ivar maximum: Gets or sets the maximum. + :vartype maximum: int + :ivar default: Gets or sets the default. + :vartype default: int + :ivar 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 + :vartype scale_type: str or ~azure.mgmt.appplatform.v2020_07_01.models.SkuScaleType """ _validation = { @@ -2208,6 +2728,17 @@ def __init__( self, **kwargs ): + """ + :keyword minimum: Required. Gets or sets the minimum. + :paramtype minimum: int + :keyword maximum: Gets or sets the maximum. + :paramtype maximum: int + :keyword default: Gets or sets the default. + :paramtype default: int + :keyword scale_type: Gets or sets the type of the scale. Possible values include: "None", + "Manual", "Automatic". + :paramtype scale_type: str or ~azure.mgmt.appplatform.v2020_07_01.models.SkuScaleType + """ super(SkuCapacity, self).__init__(**kwargs) self.minimum = kwargs['minimum'] self.maximum = kwargs.get('maximum', None) @@ -2218,14 +2749,14 @@ def __init__( 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"). + :ivar value: The raw value which could be passed to deployment CRUD operations. Possible values + include: "Java_8", "Java_11", "NetCore_31". + :vartype value: str or ~azure.mgmt.appplatform.v2020_07_01.models.SupportedRuntimeValue + :ivar 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 + :vartype platform: str or ~azure.mgmt.appplatform.v2020_07_01.models.SupportedRuntimePlatform + :ivar version: The detailed version (major.minor) of the platform. + :vartype version: str """ _attribute_map = { @@ -2238,6 +2769,16 @@ def __init__( self, **kwargs ): + """ + :keyword value: The raw value which could be passed to deployment CRUD operations. Possible + values include: "Java_8", "Java_11", "NetCore_31". + :paramtype value: str or ~azure.mgmt.appplatform.v2020_07_01.models.SupportedRuntimeValue + :keyword platform: The platform of this runtime version (possible values: "Java" or ".NET"). + Possible values include: "Java", ".NET Core". + :paramtype platform: str or ~azure.mgmt.appplatform.v2020_07_01.models.SupportedRuntimePlatform + :keyword version: The detailed version (major.minor) of the platform. + :paramtype version: str + """ super(SupportedRuntimeVersion, self).__init__(**kwargs) self.value = kwargs.get('value', None) self.platform = kwargs.get('platform', None) @@ -2247,10 +2788,10 @@ def __init__( class TemporaryDisk(msrest.serialization.Model): """Temporary disk payload. - :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. - :type mount_path: str + :ivar size_in_gb: Size of the temporary disk in GB. + :vartype size_in_gb: int + :ivar mount_path: Mount path of the temporary disk. + :vartype mount_path: str """ _validation = { @@ -2266,6 +2807,12 @@ def __init__( self, **kwargs ): + """ + :keyword size_in_gb: Size of the temporary disk in GB. + :paramtype size_in_gb: int + :keyword mount_path: Mount path of the temporary disk. + :paramtype mount_path: str + """ super(TemporaryDisk, self).__init__(**kwargs) self.size_in_gb = kwargs.get('size_in_gb', None) self.mount_path = kwargs.get('mount_path', "/tmp") @@ -2274,16 +2821,16 @@ def __init__( class TestKeys(msrest.serialization.Model): """Test keys payload. - :param primary_key: Primary key. - :type primary_key: str - :param secondary_key: Secondary key. - :type secondary_key: str - :param primary_test_endpoint: Primary test endpoint. - :type primary_test_endpoint: str - :param secondary_test_endpoint: Secondary test endpoint. - :type secondary_test_endpoint: str - :param enabled: Indicates whether the test endpoint feature enabled or not. - :type enabled: bool + :ivar primary_key: Primary key. + :vartype primary_key: str + :ivar secondary_key: Secondary key. + :vartype secondary_key: str + :ivar primary_test_endpoint: Primary test endpoint. + :vartype primary_test_endpoint: str + :ivar secondary_test_endpoint: Secondary test endpoint. + :vartype secondary_test_endpoint: str + :ivar enabled: Indicates whether the test endpoint feature enabled or not. + :vartype enabled: bool """ _attribute_map = { @@ -2298,6 +2845,18 @@ def __init__( self, **kwargs ): + """ + :keyword primary_key: Primary key. + :paramtype primary_key: str + :keyword secondary_key: Secondary key. + :paramtype secondary_key: str + :keyword primary_test_endpoint: Primary test endpoint. + :paramtype primary_test_endpoint: str + :keyword secondary_test_endpoint: Secondary test endpoint. + :paramtype secondary_test_endpoint: str + :keyword enabled: Indicates whether the test endpoint feature enabled or not. + :paramtype enabled: bool + """ super(TestKeys, self).__init__(**kwargs) self.primary_key = kwargs.get('primary_key', None) self.secondary_key = kwargs.get('secondary_key', None) @@ -2309,17 +2868,17 @@ def __init__( class UserSourceInfo(msrest.serialization.Model): """Source information for a deployment. - :param type: Type of the source uploaded. Possible values include: "Jar", "NetCoreZip", + :ivar 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. - :type version: str - :param artifact_selector: Selector for the artifact to be used for the deployment for + :vartype type: str or ~azure.mgmt.appplatform.v2020_07_01.models.UserSourceType + :ivar relative_path: Relative path of the storage which stores the source. + :vartype relative_path: str + :ivar version: Version of the source. + :vartype version: str + :ivar 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 + :vartype artifact_selector: str """ _attribute_map = { @@ -2333,6 +2892,19 @@ def __init__( self, **kwargs ): + """ + :keyword type: Type of the source uploaded. Possible values include: "Jar", "NetCoreZip", + "Source". + :paramtype type: str or ~azure.mgmt.appplatform.v2020_07_01.models.UserSourceType + :keyword relative_path: Relative path of the storage which stores the source. + :paramtype relative_path: str + :keyword version: Version of the source. + :paramtype version: str + :keyword 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. + :paramtype artifact_selector: str + """ super(UserSourceInfo, self).__init__(**kwargs) self.type = kwargs.get('type', None) self.relative_path = kwargs.get('relative_path', None) diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2020_07_01/models/_models_py3.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2020_07_01/models/_models_py3.py index 1d9493a948123..011dec21acc0c 100644 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2020_07_01/models/_models_py3.py +++ b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2020_07_01/models/_models_py3.py @@ -42,6 +42,8 @@ def __init__( self, **kwargs ): + """ + """ super(Resource, self).__init__(**kwargs) self.id = None self.name = None @@ -77,6 +79,8 @@ def __init__( self, **kwargs ): + """ + """ super(ProxyResource, self).__init__(**kwargs) @@ -91,12 +95,12 @@ 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. - :type location: str + :ivar properties: Properties of the App resource. + :vartype properties: ~azure.mgmt.appplatform.v2020_07_01.models.AppResourceProperties + :ivar identity: The Managed Identity type of the app resource. + :vartype identity: ~azure.mgmt.appplatform.v2020_07_01.models.ManagedIdentityProperties + :ivar location: The GEO location of the application, always the same with its parent resource. + :vartype location: str """ _validation = { @@ -122,6 +126,15 @@ def __init__( location: Optional[str] = None, **kwargs ): + """ + :keyword properties: Properties of the App resource. + :paramtype properties: ~azure.mgmt.appplatform.v2020_07_01.models.AppResourceProperties + :keyword identity: The Managed Identity type of the app resource. + :paramtype identity: ~azure.mgmt.appplatform.v2020_07_01.models.ManagedIdentityProperties + :keyword location: The GEO location of the application, always the same with its parent + resource. + :paramtype location: str + """ super(AppResource, self).__init__(**kwargs) self.properties = properties self.identity = identity @@ -131,11 +144,11 @@ def __init__( 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). + :ivar value: Collection of App resources. + :vartype value: list[~azure.mgmt.appplatform.v2020_07_01.models.AppResource] + :ivar 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 + :vartype next_link: str """ _attribute_map = { @@ -150,6 +163,13 @@ def __init__( next_link: Optional[str] = None, **kwargs ): + """ + :keyword value: Collection of App resources. + :paramtype value: list[~azure.mgmt.appplatform.v2020_07_01.models.AppResource] + :keyword next_link: URL client should use to fetch the next page (per server side paging). + It's null for now, added for future use. + :paramtype next_link: str + """ super(AppResourceCollection, self).__init__(**kwargs) self.value = value self.next_link = next_link @@ -160,26 +180,26 @@ class AppResourceProperties(msrest.serialization.Model): Variables are only populated by the server, and will be ignored when sending a request. - :param public: Indicates whether the App exposes public endpoint. - :type public: bool + :ivar public: Indicates whether the App exposes public endpoint. + :vartype public: bool :ivar url: URL of the App. :vartype url: str :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. - :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 active_deployment_name: Name of the active deployment of the App. + :vartype active_deployment_name: str + :ivar fqdn: Fully qualified dns Name. + :vartype fqdn: str + :ivar https_only: Indicate if only https is allowed. + :vartype https_only: bool :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 + :ivar temporary_disk: Temporary disk settings. + :vartype temporary_disk: ~azure.mgmt.appplatform.v2020_07_01.models.TemporaryDisk + :ivar persistent_disk: Persistent disk settings. + :vartype persistent_disk: ~azure.mgmt.appplatform.v2020_07_01.models.PersistentDisk """ _validation = { @@ -211,6 +231,20 @@ def __init__( persistent_disk: Optional["PersistentDisk"] = None, **kwargs ): + """ + :keyword public: Indicates whether the App exposes public endpoint. + :paramtype public: bool + :keyword active_deployment_name: Name of the active deployment of the App. + :paramtype active_deployment_name: str + :keyword fqdn: Fully qualified dns Name. + :paramtype fqdn: str + :keyword https_only: Indicate if only https is allowed. + :paramtype https_only: bool + :keyword temporary_disk: Temporary disk settings. + :paramtype temporary_disk: ~azure.mgmt.appplatform.v2020_07_01.models.TemporaryDisk + :keyword persistent_disk: Persistent disk settings. + :paramtype persistent_disk: ~azure.mgmt.appplatform.v2020_07_01.models.PersistentDisk + """ super(AppResourceProperties, self).__init__(**kwargs) self.public = public self.url = None @@ -226,11 +260,11 @@ def __init__( 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). + :ivar value: Collection of available operation details. + :vartype value: list[~azure.mgmt.appplatform.v2020_07_01.models.OperationDetail] + :ivar 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 + :vartype next_link: str """ _attribute_map = { @@ -245,6 +279,13 @@ def __init__( next_link: Optional[str] = None, **kwargs ): + """ + :keyword value: Collection of available operation details. + :paramtype value: list[~azure.mgmt.appplatform.v2020_07_01.models.OperationDetail] + :keyword next_link: URL client should use to fetch the next page (per server side paging). + It's null for now, added for future use. + :paramtype next_link: str + """ super(AvailableOperations, self).__init__(**kwargs) self.value = value self.next_link = next_link @@ -271,6 +312,8 @@ def __init__( self, **kwargs ): + """ + """ super(AvailableRuntimeVersions, self).__init__(**kwargs) self.value = None @@ -286,8 +329,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 + :ivar properties: Properties of the Binding resource. + :vartype properties: ~azure.mgmt.appplatform.v2020_07_01.models.BindingResourceProperties """ _validation = { @@ -309,6 +352,10 @@ def __init__( properties: Optional["BindingResourceProperties"] = None, **kwargs ): + """ + :keyword properties: Properties of the Binding resource. + :paramtype properties: ~azure.mgmt.appplatform.v2020_07_01.models.BindingResourceProperties + """ super(BindingResource, self).__init__(**kwargs) self.properties = properties @@ -316,11 +363,11 @@ def __init__( 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). + :ivar value: Collection of Binding resources. + :vartype value: list[~azure.mgmt.appplatform.v2020_07_01.models.BindingResource] + :ivar 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 + :vartype next_link: str """ _attribute_map = { @@ -335,6 +382,13 @@ def __init__( next_link: Optional[str] = None, **kwargs ): + """ + :keyword value: Collection of Binding resources. + :paramtype value: list[~azure.mgmt.appplatform.v2020_07_01.models.BindingResource] + :keyword next_link: URL client should use to fetch the next page (per server side paging). + It's null for now, added for future use. + :paramtype next_link: str + """ super(BindingResourceCollection, self).__init__(**kwargs) self.value = value self.next_link = next_link @@ -349,12 +403,12 @@ class BindingResourceProperties(msrest.serialization.Model): :vartype resource_name: str :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. - :type resource_id: str - :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, any] + :ivar resource_id: The Azure resource id of the bound resource. + :vartype resource_id: str + :ivar key: The key of the bound resource. + :vartype key: str + :ivar binding_parameters: Binding parameters of the Binding resource. + :vartype 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 @@ -391,6 +445,14 @@ def __init__( binding_parameters: Optional[Dict[str, Any]] = None, **kwargs ): + """ + :keyword resource_id: The Azure resource id of the bound resource. + :paramtype resource_id: str + :keyword key: The key of the bound resource. + :paramtype key: str + :keyword binding_parameters: Binding parameters of the Binding resource. + :paramtype binding_parameters: dict[str, any] + """ super(BindingResourceProperties, self).__init__(**kwargs) self.resource_name = None self.resource_type = None @@ -411,12 +473,12 @@ class CertificateProperties(msrest.serialization.Model): :ivar thumbprint: The thumbprint of certificate. :vartype thumbprint: str - :param vault_uri: Required. The vault uri of user key vault. - :type vault_uri: str - :param key_vault_cert_name: Required. The certificate name of key vault. - :type key_vault_cert_name: str - :param cert_version: The certificate version of key vault. - :type cert_version: str + :ivar vault_uri: Required. The vault uri of user key vault. + :vartype vault_uri: str + :ivar key_vault_cert_name: Required. The certificate name of key vault. + :vartype key_vault_cert_name: str + :ivar cert_version: The certificate version of key vault. + :vartype cert_version: str :ivar issuer: The issuer of certificate. :vartype issuer: str :ivar issued_date: The issue date of certificate. @@ -464,6 +526,14 @@ def __init__( cert_version: Optional[str] = None, **kwargs ): + """ + :keyword vault_uri: Required. The vault uri of user key vault. + :paramtype vault_uri: str + :keyword key_vault_cert_name: Required. The certificate name of key vault. + :paramtype key_vault_cert_name: str + :keyword cert_version: The certificate version of key vault. + :paramtype cert_version: str + """ super(CertificateProperties, self).__init__(**kwargs) self.thumbprint = None self.vault_uri = vault_uri @@ -488,8 +558,8 @@ class CertificateResource(ProxyResource): :vartype name: str :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 + :ivar properties: Properties of the certificate resource payload. + :vartype properties: ~azure.mgmt.appplatform.v2020_07_01.models.CertificateProperties """ _validation = { @@ -511,6 +581,10 @@ def __init__( properties: Optional["CertificateProperties"] = None, **kwargs ): + """ + :keyword properties: Properties of the certificate resource payload. + :paramtype properties: ~azure.mgmt.appplatform.v2020_07_01.models.CertificateProperties + """ super(CertificateResource, self).__init__(**kwargs) self.properties = properties @@ -518,10 +592,10 @@ def __init__( class CertificateResourceCollection(msrest.serialization.Model): """Collection compose of certificate resources list and a possible link for next page. - :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 + :ivar value: The certificate resources list. + :vartype value: list[~azure.mgmt.appplatform.v2020_07_01.models.CertificateResource] + :ivar next_link: The link to next page of certificate list. + :vartype next_link: str """ _attribute_map = { @@ -536,6 +610,12 @@ def __init__( next_link: Optional[str] = None, **kwargs ): + """ + :keyword value: The certificate resources list. + :paramtype value: list[~azure.mgmt.appplatform.v2020_07_01.models.CertificateResource] + :keyword next_link: The link to next page of certificate list. + :paramtype next_link: str + """ super(CertificateResourceCollection, self).__init__(**kwargs) self.value = value self.next_link = next_link @@ -544,17 +624,17 @@ def __init__( 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 + :ivar 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 + :vartype code: str + :ivar 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 + :vartype message: str + :ivar 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] + :vartype target: str + :ivar details: A list of additional details about the error. + :vartype details: list[~azure.mgmt.appplatform.v2020_07_01.models.CloudErrorBody] """ _attribute_map = { @@ -573,6 +653,19 @@ def __init__( details: Optional[List["CloudErrorBody"]] = None, **kwargs ): + """ + :keyword code: An identifier for the error. Codes are invariant and are intended to be consumed + programmatically. + :paramtype code: str + :keyword message: A message describing the error, intended to be suitable for display in a user + interface. + :paramtype message: str + :keyword target: The target of the particular error. For example, the name of the property in + error. + :paramtype target: str + :keyword details: A list of additional details about the error. + :paramtype details: list[~azure.mgmt.appplatform.v2020_07_01.models.CloudErrorBody] + """ super(CloudErrorBody, self).__init__(**kwargs) self.code = code self.message = message @@ -590,8 +683,8 @@ class ClusterResourceProperties(msrest.serialization.Model): "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 network_profile: Network profile of the Service. + :vartype 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. @@ -617,6 +710,10 @@ def __init__( network_profile: Optional["NetworkProfile"] = None, **kwargs ): + """ + :keyword network_profile: Network profile of the Service. + :paramtype network_profile: ~azure.mgmt.appplatform.v2020_07_01.models.NetworkProfile + """ super(ClusterResourceProperties, self).__init__(**kwargs) self.provisioning_state = None self.network_profile = network_profile @@ -629,26 +726,26 @@ class ConfigServerGitProperty(msrest.serialization.Model): 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 uri: str - :param label: Label of the repository. - :type label: str - :param search_paths: Searching path of the repository. - :type search_paths: list[str] - :param username: Username of git repository basic auth. - :type username: str - :param password: Password of git repository basic auth. - :type password: str - :param host_key: Public sshKey of git repository. - :type host_key: str - :param host_key_algorithm: SshKey algorithm of git repository. - :type host_key_algorithm: str - :param private_key: Private sshKey algorithm of git repository. - :type private_key: str - :param strict_host_key_checking: Strict host key checking or not. - :type strict_host_key_checking: bool + :ivar repositories: Repositories of git. + :vartype repositories: list[~azure.mgmt.appplatform.v2020_07_01.models.GitPatternRepository] + :ivar uri: Required. URI of the repository. + :vartype uri: str + :ivar label: Label of the repository. + :vartype label: str + :ivar search_paths: Searching path of the repository. + :vartype search_paths: list[str] + :ivar username: Username of git repository basic auth. + :vartype username: str + :ivar password: Password of git repository basic auth. + :vartype password: str + :ivar host_key: Public sshKey of git repository. + :vartype host_key: str + :ivar host_key_algorithm: SshKey algorithm of git repository. + :vartype host_key_algorithm: str + :ivar private_key: Private sshKey algorithm of git repository. + :vartype private_key: str + :ivar strict_host_key_checking: Strict host key checking or not. + :vartype strict_host_key_checking: bool """ _validation = { @@ -683,6 +780,28 @@ def __init__( strict_host_key_checking: Optional[bool] = None, **kwargs ): + """ + :keyword repositories: Repositories of git. + :paramtype repositories: list[~azure.mgmt.appplatform.v2020_07_01.models.GitPatternRepository] + :keyword uri: Required. URI of the repository. + :paramtype uri: str + :keyword label: Label of the repository. + :paramtype label: str + :keyword search_paths: Searching path of the repository. + :paramtype search_paths: list[str] + :keyword username: Username of git repository basic auth. + :paramtype username: str + :keyword password: Password of git repository basic auth. + :paramtype password: str + :keyword host_key: Public sshKey of git repository. + :paramtype host_key: str + :keyword host_key_algorithm: SshKey algorithm of git repository. + :paramtype host_key_algorithm: str + :keyword private_key: Private sshKey algorithm of git repository. + :paramtype private_key: str + :keyword strict_host_key_checking: Strict host key checking or not. + :paramtype strict_host_key_checking: bool + """ super(ConfigServerGitProperty, self).__init__(**kwargs) self.repositories = repositories self.uri = uri @@ -705,10 +824,10 @@ class ConfigServerProperties(msrest.serialization.Model): "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 + :ivar error: Error when apply config server settings. + :vartype error: ~azure.mgmt.appplatform.v2020_07_01.models.Error + :ivar config_server: Settings of config server. + :vartype config_server: ~azure.mgmt.appplatform.v2020_07_01.models.ConfigServerSettings """ _validation = { @@ -728,6 +847,12 @@ def __init__( config_server: Optional["ConfigServerSettings"] = None, **kwargs ): + """ + :keyword error: Error when apply config server settings. + :paramtype error: ~azure.mgmt.appplatform.v2020_07_01.models.Error + :keyword config_server: Settings of config server. + :paramtype config_server: ~azure.mgmt.appplatform.v2020_07_01.models.ConfigServerSettings + """ super(ConfigServerProperties, self).__init__(**kwargs) self.provisioning_state = None self.error = error @@ -745,8 +870,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 + :ivar properties: Properties of the Config Server resource. + :vartype properties: ~azure.mgmt.appplatform.v2020_07_01.models.ConfigServerProperties """ _validation = { @@ -768,6 +893,10 @@ def __init__( properties: Optional["ConfigServerProperties"] = None, **kwargs ): + """ + :keyword properties: Properties of the Config Server resource. + :paramtype properties: ~azure.mgmt.appplatform.v2020_07_01.models.ConfigServerProperties + """ super(ConfigServerResource, self).__init__(**kwargs) self.properties = properties @@ -775,8 +904,8 @@ def __init__( 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 + :ivar git_property: Property of git environment. + :vartype git_property: ~azure.mgmt.appplatform.v2020_07_01.models.ConfigServerGitProperty """ _attribute_map = { @@ -789,6 +918,10 @@ def __init__( git_property: Optional["ConfigServerGitProperty"] = None, **kwargs ): + """ + :keyword git_property: Property of git environment. + :paramtype git_property: ~azure.mgmt.appplatform.v2020_07_01.models.ConfigServerGitProperty + """ super(ConfigServerSettings, self).__init__(**kwargs) self.git_property = git_property @@ -796,12 +929,12 @@ def __init__( class ConfigServerSettingsErrorRecord(msrest.serialization.Model): """Error record of the config server settings. - :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. - :type uri: str - :param messages: The detail error messages of the record. - :type messages: list[str] + :ivar name: The name of the config server settings error record. + :vartype name: str + :ivar uri: The uri of the config server settings error record. + :vartype uri: str + :ivar messages: The detail error messages of the record. + :vartype messages: list[str] """ _attribute_map = { @@ -818,6 +951,14 @@ def __init__( messages: Optional[List[str]] = None, **kwargs ): + """ + :keyword name: The name of the config server settings error record. + :paramtype name: str + :keyword uri: The uri of the config server settings error record. + :paramtype uri: str + :keyword messages: The detail error messages of the record. + :paramtype messages: list[str] + """ super(ConfigServerSettingsErrorRecord, self).__init__(**kwargs) self.name = name self.uri = uri @@ -827,10 +968,11 @@ def __init__( class ConfigServerSettingsValidateResult(msrest.serialization.Model): """Validation result for config server settings. - :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] + :ivar is_valid: Indicate if the config server settings are valid. + :vartype is_valid: bool + :ivar details: The detail validation results. + :vartype details: + list[~azure.mgmt.appplatform.v2020_07_01.models.ConfigServerSettingsErrorRecord] """ _attribute_map = { @@ -845,6 +987,13 @@ def __init__( details: Optional[List["ConfigServerSettingsErrorRecord"]] = None, **kwargs ): + """ + :keyword is_valid: Indicate if the config server settings are valid. + :paramtype is_valid: bool + :keyword details: The detail validation results. + :paramtype details: + list[~azure.mgmt.appplatform.v2020_07_01.models.ConfigServerSettingsErrorRecord] + """ super(ConfigServerSettingsValidateResult, self).__init__(**kwargs) self.is_valid = is_valid self.details = details @@ -855,12 +1004,12 @@ class CustomDomainProperties(msrest.serialization.Model): 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 + :ivar thumbprint: The thumbprint of bound certificate. + :vartype thumbprint: str :ivar app_name: The app name of domain. :vartype app_name: str - :param cert_name: The bound certificate name of domain. - :type cert_name: str + :ivar cert_name: The bound certificate name of domain. + :vartype cert_name: str """ _validation = { @@ -880,6 +1029,12 @@ def __init__( cert_name: Optional[str] = None, **kwargs ): + """ + :keyword thumbprint: The thumbprint of bound certificate. + :paramtype thumbprint: str + :keyword cert_name: The bound certificate name of domain. + :paramtype cert_name: str + """ super(CustomDomainProperties, self).__init__(**kwargs) self.thumbprint = thumbprint self.app_name = None @@ -897,8 +1052,8 @@ class CustomDomainResource(ProxyResource): :vartype name: str :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 + :ivar properties: Properties of the custom domain resource. + :vartype properties: ~azure.mgmt.appplatform.v2020_07_01.models.CustomDomainProperties """ _validation = { @@ -920,6 +1075,10 @@ def __init__( properties: Optional["CustomDomainProperties"] = None, **kwargs ): + """ + :keyword properties: Properties of the custom domain resource. + :paramtype properties: ~azure.mgmt.appplatform.v2020_07_01.models.CustomDomainProperties + """ super(CustomDomainResource, self).__init__(**kwargs) self.properties = properties @@ -927,10 +1086,10 @@ def __init__( 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 + :ivar value: The custom domain resources list. + :vartype value: list[~azure.mgmt.appplatform.v2020_07_01.models.CustomDomainResource] + :ivar next_link: The link to next page of custom domain list. + :vartype next_link: str """ _attribute_map = { @@ -945,6 +1104,12 @@ def __init__( next_link: Optional[str] = None, **kwargs ): + """ + :keyword value: The custom domain resources list. + :paramtype value: list[~azure.mgmt.appplatform.v2020_07_01.models.CustomDomainResource] + :keyword next_link: The link to next page of custom domain list. + :paramtype next_link: str + """ super(CustomDomainResourceCollection, self).__init__(**kwargs) self.value = value self.next_link = next_link @@ -955,8 +1120,8 @@ class CustomDomainValidatePayload(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param name: Required. Name to be validated. - :type name: str + :ivar name: Required. Name to be validated. + :vartype name: str """ _validation = { @@ -973,6 +1138,10 @@ def __init__( name: str, **kwargs ): + """ + :keyword name: Required. Name to be validated. + :paramtype name: str + """ super(CustomDomainValidatePayload, self).__init__(**kwargs) self.name = name @@ -980,10 +1149,10 @@ def __init__( class CustomDomainValidateResult(msrest.serialization.Model): """Validation result for custom domain. - :param is_valid: Indicates if domain name is valid. - :type is_valid: bool - :param message: Message of why domain name is invalid. - :type message: str + :ivar is_valid: Indicates if domain name is valid. + :vartype is_valid: bool + :ivar message: Message of why domain name is invalid. + :vartype message: str """ _attribute_map = { @@ -998,6 +1167,12 @@ def __init__( message: Optional[str] = None, **kwargs ): + """ + :keyword is_valid: Indicates if domain name is valid. + :paramtype is_valid: bool + :keyword message: Message of why domain name is invalid. + :paramtype message: str + """ super(CustomDomainValidateResult, self).__init__(**kwargs) self.is_valid = is_valid self.message = message @@ -1040,6 +1215,8 @@ def __init__( self, **kwargs ): + """ + """ super(DeploymentInstance, self).__init__(**kwargs) self.name = None self.status = None @@ -1059,10 +1236,10 @@ 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. - :type sku: ~azure.mgmt.appplatform.v2020_07_01.models.Sku + :ivar properties: Properties of the Deployment resource. + :vartype properties: ~azure.mgmt.appplatform.v2020_07_01.models.DeploymentResourceProperties + :ivar sku: Sku of the Deployment resource. + :vartype sku: ~azure.mgmt.appplatform.v2020_07_01.models.Sku """ _validation = { @@ -1086,6 +1263,12 @@ def __init__( sku: Optional["Sku"] = None, **kwargs ): + """ + :keyword properties: Properties of the Deployment resource. + :paramtype properties: ~azure.mgmt.appplatform.v2020_07_01.models.DeploymentResourceProperties + :keyword sku: Sku of the Deployment resource. + :paramtype sku: ~azure.mgmt.appplatform.v2020_07_01.models.Sku + """ super(DeploymentResource, self).__init__(**kwargs) self.properties = properties self.sku = sku @@ -1094,11 +1277,11 @@ def __init__( 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). + :ivar value: Collection of Deployment resources. + :vartype value: list[~azure.mgmt.appplatform.v2020_07_01.models.DeploymentResource] + :ivar 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 + :vartype next_link: str """ _attribute_map = { @@ -1113,6 +1296,13 @@ def __init__( next_link: Optional[str] = None, **kwargs ): + """ + :keyword value: Collection of Deployment resources. + :paramtype value: list[~azure.mgmt.appplatform.v2020_07_01.models.DeploymentResource] + :keyword next_link: URL client should use to fetch the next page (per server side paging). + It's null for now, added for future use. + :paramtype next_link: str + """ super(DeploymentResourceCollection, self).__init__(**kwargs) self.value = value self.next_link = next_link @@ -1123,12 +1313,12 @@ class DeploymentResourceProperties(msrest.serialization.Model): 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 source: Uploaded source information of the deployment. + :vartype source: ~azure.mgmt.appplatform.v2020_07_01.models.UserSourceInfo :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 deployment_settings: Deployment settings of the Deployment. + :vartype 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 @@ -1171,6 +1361,12 @@ def __init__( deployment_settings: Optional["DeploymentSettings"] = None, **kwargs ): + """ + :keyword source: Uploaded source information of the deployment. + :paramtype source: ~azure.mgmt.appplatform.v2020_07_01.models.UserSourceInfo + :keyword deployment_settings: Deployment settings of the Deployment. + :paramtype deployment_settings: ~azure.mgmt.appplatform.v2020_07_01.models.DeploymentSettings + """ super(DeploymentResourceProperties, self).__init__(**kwargs) self.source = source self.app_name = None @@ -1185,20 +1381,20 @@ def __init__( 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). - :type cpu: int - :param memory_in_gb: Required Memory size in GB, basic tier should be in range (1, 2), standard + :ivar cpu: Required CPU, basic tier should be 1, standard tier should be in range (1, 4). + :vartype cpu: int + :ivar 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. - :type jvm_options: str - :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. - :type environment_variables: dict[str, str] - :param runtime_version: Runtime version. Possible values include: "Java_8", "Java_11", + :vartype memory_in_gb: int + :ivar jvm_options: JVM parameter. + :vartype jvm_options: str + :ivar net_core_main_entry_path: The path to the .NET executable relative to zip root. + :vartype net_core_main_entry_path: str + :ivar environment_variables: Collection of environment variables. + :vartype environment_variables: dict[str, str] + :ivar 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 + :vartype runtime_version: str or ~azure.mgmt.appplatform.v2020_07_01.models.RuntimeVersion """ _attribute_map = { @@ -1221,6 +1417,22 @@ def __init__( runtime_version: Optional[Union[str, "RuntimeVersion"]] = "Java_8", **kwargs ): + """ + :keyword cpu: Required CPU, basic tier should be 1, standard tier should be in range (1, 4). + :paramtype cpu: int + :keyword memory_in_gb: Required Memory size in GB, basic tier should be in range (1, 2), + standard tier should be in range (1, 8). + :paramtype memory_in_gb: int + :keyword jvm_options: JVM parameter. + :paramtype jvm_options: str + :keyword net_core_main_entry_path: The path to the .NET executable relative to zip root. + :paramtype net_core_main_entry_path: str + :keyword environment_variables: Collection of environment variables. + :paramtype environment_variables: dict[str, str] + :keyword runtime_version: Runtime version. Possible values include: "Java_8", "Java_11", + "NetCore_31". Default value: "Java_8". + :paramtype runtime_version: str or ~azure.mgmt.appplatform.v2020_07_01.models.RuntimeVersion + """ super(DeploymentSettings, self).__init__(**kwargs) self.cpu = cpu self.memory_in_gb = memory_in_gb @@ -1233,10 +1445,10 @@ def __init__( class Error(msrest.serialization.Model): """The error code compose of code and message. - :param code: The code of error. - :type code: str - :param message: The message of error. - :type message: str + :ivar code: The code of error. + :vartype code: str + :ivar message: The message of error. + :vartype message: str """ _attribute_map = { @@ -1251,6 +1463,12 @@ def __init__( message: Optional[str] = None, **kwargs ): + """ + :keyword code: The code of error. + :paramtype code: str + :keyword message: The message of error. + :paramtype message: str + """ super(Error, self).__init__(**kwargs) self.code = code self.message = message @@ -1261,28 +1479,28 @@ class GitPatternRepository(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param name: Required. Name of the repository. - :type name: str - :param pattern: Collection of pattern of the repository. - :type pattern: list[str] - :param uri: Required. URI of the repository. - :type uri: str - :param label: Label of the repository. - :type label: str - :param search_paths: Searching path of the repository. - :type search_paths: list[str] - :param username: Username of git repository basic auth. - :type username: str - :param password: Password of git repository basic auth. - :type password: str - :param host_key: Public sshKey of git repository. - :type host_key: str - :param host_key_algorithm: SshKey algorithm of git repository. - :type host_key_algorithm: str - :param private_key: Private sshKey algorithm of git repository. - :type private_key: str - :param strict_host_key_checking: Strict host key checking or not. - :type strict_host_key_checking: bool + :ivar name: Required. Name of the repository. + :vartype name: str + :ivar pattern: Collection of pattern of the repository. + :vartype pattern: list[str] + :ivar uri: Required. URI of the repository. + :vartype uri: str + :ivar label: Label of the repository. + :vartype label: str + :ivar search_paths: Searching path of the repository. + :vartype search_paths: list[str] + :ivar username: Username of git repository basic auth. + :vartype username: str + :ivar password: Password of git repository basic auth. + :vartype password: str + :ivar host_key: Public sshKey of git repository. + :vartype host_key: str + :ivar host_key_algorithm: SshKey algorithm of git repository. + :vartype host_key_algorithm: str + :ivar private_key: Private sshKey algorithm of git repository. + :vartype private_key: str + :ivar strict_host_key_checking: Strict host key checking or not. + :vartype strict_host_key_checking: bool """ _validation = { @@ -1320,6 +1538,30 @@ def __init__( strict_host_key_checking: Optional[bool] = None, **kwargs ): + """ + :keyword name: Required. Name of the repository. + :paramtype name: str + :keyword pattern: Collection of pattern of the repository. + :paramtype pattern: list[str] + :keyword uri: Required. URI of the repository. + :paramtype uri: str + :keyword label: Label of the repository. + :paramtype label: str + :keyword search_paths: Searching path of the repository. + :paramtype search_paths: list[str] + :keyword username: Username of git repository basic auth. + :paramtype username: str + :keyword password: Password of git repository basic auth. + :paramtype password: str + :keyword host_key: Public sshKey of git repository. + :paramtype host_key: str + :keyword host_key_algorithm: SshKey algorithm of git repository. + :paramtype host_key_algorithm: str + :keyword private_key: Private sshKey algorithm of git repository. + :paramtype private_key: str + :keyword strict_host_key_checking: Strict host key checking or not. + :paramtype strict_host_key_checking: bool + """ super(GitPatternRepository, self).__init__(**kwargs) self.name = name self.pattern = pattern @@ -1339,8 +1581,8 @@ class LogFileUrlResponse(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param url: Required. URL of the log file. - :type url: str + :ivar url: Required. URL of the log file. + :vartype url: str """ _validation = { @@ -1357,6 +1599,10 @@ def __init__( url: str, **kwargs ): + """ + :keyword url: Required. URL of the log file. + :paramtype url: str + """ super(LogFileUrlResponse, self).__init__(**kwargs) self.url = url @@ -1364,12 +1610,12 @@ def __init__( class LogSpecification(msrest.serialization.Model): """Specifications of the Log for Azure Monitoring. - :param name: Name of the log. - :type name: str - :param display_name: Localized friendly display name of the log. - :type display_name: str - :param blob_duration: Blob duration of the log. - :type blob_duration: str + :ivar name: Name of the log. + :vartype name: str + :ivar display_name: Localized friendly display name of the log. + :vartype display_name: str + :ivar blob_duration: Blob duration of the log. + :vartype blob_duration: str """ _attribute_map = { @@ -1386,6 +1632,14 @@ def __init__( blob_duration: Optional[str] = None, **kwargs ): + """ + :keyword name: Name of the log. + :paramtype name: str + :keyword display_name: Localized friendly display name of the log. + :paramtype display_name: str + :keyword blob_duration: Blob duration of the log. + :paramtype blob_duration: str + """ super(LogSpecification, self).__init__(**kwargs) self.name = name self.display_name = display_name @@ -1395,13 +1649,13 @@ def __init__( 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", + :ivar 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. - :type tenant_id: str + :vartype type: str or ~azure.mgmt.appplatform.v2020_07_01.models.ManagedIdentityType + :ivar principal_id: Principal Id. + :vartype principal_id: str + :ivar tenant_id: Tenant Id. + :vartype tenant_id: str """ _attribute_map = { @@ -1418,6 +1672,15 @@ def __init__( tenant_id: Optional[str] = None, **kwargs ): + """ + :keyword type: Type of the managed identity. Possible values include: "None", "SystemAssigned", + "UserAssigned", "SystemAssigned,UserAssigned". + :paramtype type: str or ~azure.mgmt.appplatform.v2020_07_01.models.ManagedIdentityType + :keyword principal_id: Principal Id. + :paramtype principal_id: str + :keyword tenant_id: Tenant Id. + :paramtype tenant_id: str + """ super(ManagedIdentityProperties, self).__init__(**kwargs) self.type = type self.principal_id = principal_id @@ -1427,13 +1690,13 @@ def __init__( class MetricDimension(msrest.serialization.Model): """Specifications of the Dimension of metrics. - :param name: Name of the dimension. - :type name: str - :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 + :ivar name: Name of the dimension. + :vartype name: str + :ivar display_name: Localized friendly display name of the dimension. + :vartype display_name: str + :ivar to_be_exported_for_shoebox: Whether this dimension should be included for the Shoebox export scenario. - :type to_be_exported_for_shoebox: bool + :vartype to_be_exported_for_shoebox: bool """ _attribute_map = { @@ -1450,6 +1713,15 @@ def __init__( to_be_exported_for_shoebox: Optional[bool] = None, **kwargs ): + """ + :keyword name: Name of the dimension. + :paramtype name: str + :keyword display_name: Localized friendly display name of the dimension. + :paramtype display_name: str + :keyword to_be_exported_for_shoebox: Whether this dimension should be included for the Shoebox + export scenario. + :paramtype to_be_exported_for_shoebox: bool + """ super(MetricDimension, self).__init__(**kwargs) self.name = name self.display_name = display_name @@ -1459,29 +1731,31 @@ def __init__( class MetricSpecification(msrest.serialization.Model): """Specifications of the Metrics for Azure Monitoring. - :param name: Name of the metric. - :type name: str - :param display_name: Localized friendly display name of the metric. - :type display_name: str - :param display_description: Localized friendly description of the metric. - :type display_description: str - :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 + :ivar name: Name of the metric. + :vartype name: str + :ivar display_name: Localized friendly display name of the metric. + :vartype display_name: str + :ivar display_description: Localized friendly description of the metric. + :vartype display_description: str + :ivar unit: Unit that makes sense for the metric. + :vartype unit: str + :ivar 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, + :vartype category: str + :ivar 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. - :type supported_aggregation_types: list[str] - :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 + :vartype aggregation_type: str + :ivar supported_aggregation_types: Supported aggregation types. + :vartype supported_aggregation_types: list[str] + :ivar supported_time_grain_types: Supported time grain types. + :vartype supported_time_grain_types: list[str] + :ivar 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] + :vartype fill_gap_with_zero: bool + :ivar dimensions: Dimensions of the metric. + :vartype dimensions: list[~azure.mgmt.appplatform.v2020_07_01.models.MetricDimension] + :ivar source_mdm_namespace: Name of the MDM namespace. Optional. + :vartype source_mdm_namespace: str """ _attribute_map = { @@ -1495,6 +1769,7 @@ class MetricSpecification(msrest.serialization.Model): 'supported_time_grain_types': {'key': 'supportedTimeGrainTypes', 'type': '[str]'}, 'fill_gap_with_zero': {'key': 'fillGapWithZero', 'type': 'bool'}, 'dimensions': {'key': 'dimensions', 'type': '[MetricDimension]'}, + 'source_mdm_namespace': {'key': 'sourceMdmNamespace', 'type': 'str'}, } def __init__( @@ -1510,8 +1785,36 @@ def __init__( supported_time_grain_types: Optional[List[str]] = None, fill_gap_with_zero: Optional[bool] = None, dimensions: Optional[List["MetricDimension"]] = None, - **kwargs - ): + source_mdm_namespace: Optional[str] = None, + **kwargs + ): + """ + :keyword name: Name of the metric. + :paramtype name: str + :keyword display_name: Localized friendly display name of the metric. + :paramtype display_name: str + :keyword display_description: Localized friendly description of the metric. + :paramtype display_description: str + :keyword unit: Unit that makes sense for the metric. + :paramtype unit: str + :keyword category: Name of the metric category that the metric belongs to. A metric can only + belong to a single category. + :paramtype category: str + :keyword aggregation_type: Only provide one value for this field. Valid values: Average, + Minimum, Maximum, Total, Count. + :paramtype aggregation_type: str + :keyword supported_aggregation_types: Supported aggregation types. + :paramtype supported_aggregation_types: list[str] + :keyword supported_time_grain_types: Supported time grain types. + :paramtype supported_time_grain_types: list[str] + :keyword fill_gap_with_zero: Optional. If set to true, then zero will be returned for time + duration where no metric is emitted/published. + :paramtype fill_gap_with_zero: bool + :keyword dimensions: Dimensions of the metric. + :paramtype dimensions: list[~azure.mgmt.appplatform.v2020_07_01.models.MetricDimension] + :keyword source_mdm_namespace: Name of the MDM namespace. Optional. + :paramtype source_mdm_namespace: str + """ super(MetricSpecification, self).__init__(**kwargs) self.name = name self.display_name = display_name @@ -1523,6 +1826,7 @@ def __init__( self.supported_time_grain_types = supported_time_grain_types self.fill_gap_with_zero = fill_gap_with_zero self.dimensions = dimensions + self.source_mdm_namespace = source_mdm_namespace class MonitoringSettingProperties(msrest.serialization.Model): @@ -1534,12 +1838,12 @@ class MonitoringSettingProperties(msrest.serialization.Model): "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. - :type trace_enabled: bool - :param app_insights_instrumentation_key: Target application insight instrumentation key. - :type app_insights_instrumentation_key: str + :ivar error: Error when apply Monitoring Setting changes. + :vartype error: ~azure.mgmt.appplatform.v2020_07_01.models.Error + :ivar trace_enabled: Indicates whether enable the trace functionality. + :vartype trace_enabled: bool + :ivar app_insights_instrumentation_key: Target application insight instrumentation key. + :vartype app_insights_instrumentation_key: str """ _validation = { @@ -1561,6 +1865,14 @@ def __init__( app_insights_instrumentation_key: Optional[str] = None, **kwargs ): + """ + :keyword error: Error when apply Monitoring Setting changes. + :paramtype error: ~azure.mgmt.appplatform.v2020_07_01.models.Error + :keyword trace_enabled: Indicates whether enable the trace functionality. + :paramtype trace_enabled: bool + :keyword app_insights_instrumentation_key: Target application insight instrumentation key. + :paramtype app_insights_instrumentation_key: str + """ super(MonitoringSettingProperties, self).__init__(**kwargs) self.provisioning_state = None self.error = error @@ -1579,8 +1891,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 + :ivar properties: Properties of the Monitoring Setting resource. + :vartype properties: ~azure.mgmt.appplatform.v2020_07_01.models.MonitoringSettingProperties """ _validation = { @@ -1602,6 +1914,10 @@ def __init__( properties: Optional["MonitoringSettingProperties"] = None, **kwargs ): + """ + :keyword properties: Properties of the Monitoring Setting resource. + :paramtype properties: ~azure.mgmt.appplatform.v2020_07_01.models.MonitoringSettingProperties + """ super(MonitoringSettingResource, self).__init__(**kwargs) self.properties = properties @@ -1609,12 +1925,12 @@ def __init__( class NameAvailability(msrest.serialization.Model): """Name availability result payload. - :param name_available: Indicates whether the name is available. - :type name_available: bool - :param reason: Reason why the name is not available. - :type reason: str - :param message: Message why the name is not available. - :type message: str + :ivar name_available: Indicates whether the name is available. + :vartype name_available: bool + :ivar reason: Reason why the name is not available. + :vartype reason: str + :ivar message: Message why the name is not available. + :vartype message: str """ _attribute_map = { @@ -1631,6 +1947,14 @@ def __init__( message: Optional[str] = None, **kwargs ): + """ + :keyword name_available: Indicates whether the name is available. + :paramtype name_available: bool + :keyword reason: Reason why the name is not available. + :paramtype reason: str + :keyword message: Message why the name is not available. + :paramtype message: str + """ super(NameAvailability, self).__init__(**kwargs) self.name_available = name_available self.reason = reason @@ -1642,10 +1966,10 @@ class NameAvailabilityParameters(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param type: Required. Type of the resource to check name availability. - :type type: str - :param name: Required. Name to be checked. - :type name: str + :ivar type: Required. Type of the resource to check name availability. + :vartype type: str + :ivar name: Required. Name to be checked. + :vartype name: str """ _validation = { @@ -1665,6 +1989,12 @@ def __init__( name: str, **kwargs ): + """ + :keyword type: Required. Type of the resource to check name availability. + :paramtype type: str + :keyword name: Required. Name to be checked. + :paramtype name: str + """ super(NameAvailabilityParameters, self).__init__(**kwargs) self.type = type self.name = name @@ -1675,20 +2005,19 @@ class NetworkProfile(msrest.serialization.Model): 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. - :type service_runtime_subnet_id: str - :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. - :type service_cidr: str - :param service_runtime_network_resource_group: Name of the resource group containing network + :ivar service_runtime_subnet_id: Fully qualified resource Id of the subnet to host Azure Spring + Cloud Service Runtime. + :vartype service_runtime_subnet_id: str + :ivar app_subnet_id: Fully qualified resource Id of the subnet to host Azure Spring Cloud Apps. + :vartype app_subnet_id: str + :ivar service_cidr: Azure Spring Cloud service reserved CIDR. + :vartype service_cidr: str + :ivar 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 + :vartype service_runtime_network_resource_group: str + :ivar app_network_resource_group: Name of the resource group containing network resources of Azure Spring Cloud Apps. - :type app_network_resource_group: str + :vartype app_network_resource_group: str :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. @@ -1720,6 +2049,22 @@ def __init__( app_network_resource_group: Optional[str] = None, **kwargs ): + """ + :keyword service_runtime_subnet_id: Fully qualified resource Id of the subnet to host Azure + Spring Cloud Service Runtime. + :paramtype service_runtime_subnet_id: str + :keyword app_subnet_id: Fully qualified resource Id of the subnet to host Azure Spring Cloud + Apps. + :paramtype app_subnet_id: str + :keyword service_cidr: Azure Spring Cloud service reserved CIDR. + :paramtype service_cidr: str + :keyword service_runtime_network_resource_group: Name of the resource group containing network + resources of Azure Spring Cloud Service Runtime. + :paramtype service_runtime_network_resource_group: str + :keyword app_network_resource_group: Name of the resource group containing network resources of + Azure Spring Cloud Apps. + :paramtype app_network_resource_group: str + """ super(NetworkProfile, self).__init__(**kwargs) self.service_runtime_subnet_id = service_runtime_subnet_id self.app_subnet_id = app_subnet_id @@ -1751,6 +2096,8 @@ def __init__( self, **kwargs ): + """ + """ super(NetworkProfileOutboundIPs, self).__init__(**kwargs) self.public_i_ps = None @@ -1758,22 +2105,32 @@ def __init__( class OperationDetail(msrest.serialization.Model): """Operation detail payload. - :param name: Name of the operation. - :type name: str - :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_07_01.models.OperationDisplay - :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 + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar name: Name of the operation. + :vartype name: str + :ivar is_data_action: Indicates whether the operation is a data action. + :vartype is_data_action: bool + :ivar display: Display of the operation. + :vartype display: ~azure.mgmt.appplatform.v2020_07_01.models.OperationDisplay + :ivar action_type: Enum. Indicates the action type. "Internal" refers to actions that are for + internal only APIs. Possible values include: "Internal". + :vartype action_type: str or ~azure.mgmt.appplatform.v2020_07_01.models.ActionType + :ivar origin: Origin of the operation. + :vartype origin: str + :ivar properties: Properties of the operation. + :vartype properties: ~azure.mgmt.appplatform.v2020_07_01.models.OperationProperties """ + _validation = { + 'action_type': {'readonly': True}, + } + _attribute_map = { 'name': {'key': 'name', 'type': 'str'}, 'is_data_action': {'key': 'isDataAction', 'type': 'bool'}, 'display': {'key': 'display', 'type': 'OperationDisplay'}, + 'action_type': {'key': 'actionType', 'type': 'str'}, 'origin': {'key': 'origin', 'type': 'str'}, 'properties': {'key': 'properties', 'type': 'OperationProperties'}, } @@ -1788,10 +2145,23 @@ def __init__( properties: Optional["OperationProperties"] = None, **kwargs ): + """ + :keyword name: Name of the operation. + :paramtype name: str + :keyword is_data_action: Indicates whether the operation is a data action. + :paramtype is_data_action: bool + :keyword display: Display of the operation. + :paramtype display: ~azure.mgmt.appplatform.v2020_07_01.models.OperationDisplay + :keyword origin: Origin of the operation. + :paramtype origin: str + :keyword properties: Properties of the operation. + :paramtype properties: ~azure.mgmt.appplatform.v2020_07_01.models.OperationProperties + """ super(OperationDetail, self).__init__(**kwargs) self.name = name self.is_data_action = is_data_action self.display = display + self.action_type = None self.origin = origin self.properties = properties @@ -1799,14 +2169,14 @@ def __init__( class OperationDisplay(msrest.serialization.Model): """Operation display payload. - :param provider: Resource provider of the operation. - :type provider: str - :param resource: Resource of the operation. - :type resource: str - :param operation: Localized friendly name for the operation. - :type operation: str - :param description: Localized friendly description for the operation. - :type description: str + :ivar provider: Resource provider of the operation. + :vartype provider: str + :ivar resource: Resource of the operation. + :vartype resource: str + :ivar operation: Localized friendly name for the operation. + :vartype operation: str + :ivar description: Localized friendly description for the operation. + :vartype description: str """ _attribute_map = { @@ -1825,6 +2195,16 @@ def __init__( description: Optional[str] = None, **kwargs ): + """ + :keyword provider: Resource provider of the operation. + :paramtype provider: str + :keyword resource: Resource of the operation. + :paramtype resource: str + :keyword operation: Localized friendly name for the operation. + :paramtype operation: str + :keyword description: Localized friendly description for the operation. + :paramtype description: str + """ super(OperationDisplay, self).__init__(**kwargs) self.provider = provider self.resource = resource @@ -1835,8 +2215,8 @@ def __init__( 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 + :ivar service_specification: Service specifications of the operation. + :vartype service_specification: ~azure.mgmt.appplatform.v2020_07_01.models.ServiceSpecification """ _attribute_map = { @@ -1849,6 +2229,11 @@ def __init__( service_specification: Optional["ServiceSpecification"] = None, **kwargs ): + """ + :keyword service_specification: Service specifications of the operation. + :paramtype service_specification: + ~azure.mgmt.appplatform.v2020_07_01.models.ServiceSpecification + """ super(OperationProperties, self).__init__(**kwargs) self.service_specification = service_specification @@ -1858,12 +2243,12 @@ class PersistentDisk(msrest.serialization.Model): 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. - :type size_in_gb: int + :ivar size_in_gb: Size of the persistent disk in GB. + :vartype size_in_gb: int :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. - :type mount_path: str + :ivar mount_path: Mount path of the persistent disk. + :vartype mount_path: str """ _validation = { @@ -1884,6 +2269,12 @@ def __init__( mount_path: Optional[str] = None, **kwargs ): + """ + :keyword size_in_gb: Size of the persistent disk in GB. + :paramtype size_in_gb: int + :keyword mount_path: Mount path of the persistent disk. + :paramtype mount_path: str + """ super(PersistentDisk, self).__init__(**kwargs) self.size_in_gb = size_in_gb self.used_in_gb = None @@ -1895,9 +2286,9 @@ class RegenerateTestKeyRequestPayload(msrest.serialization.Model): 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", + :ivar 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 + :vartype key_type: str or ~azure.mgmt.appplatform.v2020_07_01.models.TestKeyType """ _validation = { @@ -1914,6 +2305,11 @@ def __init__( key_type: Union[str, "TestKeyType"], **kwargs ): + """ + :keyword key_type: Required. Type of the test key. Possible values include: "Primary", + "Secondary". + :paramtype key_type: str or ~azure.mgmt.appplatform.v2020_07_01.models.TestKeyType + """ super(RegenerateTestKeyRequestPayload, self).__init__(**kwargs) self.key_type = key_type @@ -1956,6 +2352,8 @@ def __init__( self, **kwargs ): + """ + """ super(RequiredTraffic, self).__init__(**kwargs) self.protocol = None self.port = None @@ -1967,22 +2365,23 @@ def __init__( class ResourceSku(msrest.serialization.Model): """Describes an available Azure Spring Cloud SKU. - :param resource_type: Gets the type of resource the SKU applies to. - :type resource_type: str - :param name: Gets the name of SKU. - :type name: str - :param tier: Gets the tier of SKU. - :type tier: str - :param capacity: Gets the capacity of SKU. - :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 + :ivar resource_type: Gets the type of resource the SKU applies to. + :vartype resource_type: str + :ivar name: Gets the name of SKU. + :vartype name: str + :ivar tier: Gets the tier of SKU. + :vartype tier: str + :ivar capacity: Gets the capacity of SKU. + :vartype capacity: ~azure.mgmt.appplatform.v2020_07_01.models.SkuCapacity + :ivar locations: Gets the set of locations that the SKU is available. + :vartype locations: list[str] + :ivar 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 + :vartype location_info: + list[~azure.mgmt.appplatform.v2020_07_01.models.ResourceSkuLocationInfo] + :ivar 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] + :vartype restrictions: list[~azure.mgmt.appplatform.v2020_07_01.models.ResourceSkuRestrictions] """ _attribute_map = { @@ -2007,6 +2406,26 @@ def __init__( restrictions: Optional[List["ResourceSkuRestrictions"]] = None, **kwargs ): + """ + :keyword resource_type: Gets the type of resource the SKU applies to. + :paramtype resource_type: str + :keyword name: Gets the name of SKU. + :paramtype name: str + :keyword tier: Gets the tier of SKU. + :paramtype tier: str + :keyword capacity: Gets the capacity of SKU. + :paramtype capacity: ~azure.mgmt.appplatform.v2020_07_01.models.SkuCapacity + :keyword locations: Gets the set of locations that the SKU is available. + :paramtype locations: list[str] + :keyword location_info: Gets a list of locations and availability zones in those locations + where the SKU is available. + :paramtype location_info: + list[~azure.mgmt.appplatform.v2020_07_01.models.ResourceSkuLocationInfo] + :keyword restrictions: Gets the restrictions because of which SKU cannot be used. This is + empty if there are no restrictions. + :paramtype restrictions: + list[~azure.mgmt.appplatform.v2020_07_01.models.ResourceSkuRestrictions] + """ super(ResourceSku, self).__init__(**kwargs) self.resource_type = resource_type self.name = name @@ -2020,10 +2439,10 @@ def __init__( class ResourceSkuCapabilities(msrest.serialization.Model): """ResourceSkuCapabilities. - :param name: Gets an invariant to describe the feature. - :type name: str - :param value: Gets an invariant if the feature is measured by quantity. - :type value: str + :ivar name: Gets an invariant to describe the feature. + :vartype name: str + :ivar value: Gets an invariant if the feature is measured by quantity. + :vartype value: str """ _attribute_map = { @@ -2038,6 +2457,12 @@ def __init__( value: Optional[str] = None, **kwargs ): + """ + :keyword name: Gets an invariant to describe the feature. + :paramtype name: str + :keyword value: Gets an invariant if the feature is measured by quantity. + :paramtype value: str + """ super(ResourceSkuCapabilities, self).__init__(**kwargs) self.name = name self.value = value @@ -2046,11 +2471,11 @@ def __init__( 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). + :ivar value: Collection of resource SKU. + :vartype value: list[~azure.mgmt.appplatform.v2020_07_01.models.ResourceSku] + :ivar 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 + :vartype next_link: str """ _attribute_map = { @@ -2065,6 +2490,13 @@ def __init__( next_link: Optional[str] = None, **kwargs ): + """ + :keyword value: Collection of resource SKU. + :paramtype value: list[~azure.mgmt.appplatform.v2020_07_01.models.ResourceSku] + :keyword next_link: URL client should use to fetch the next page (per server side paging). + It's null for now, added for future use. + :paramtype next_link: str + """ super(ResourceSkuCollection, self).__init__(**kwargs) self.value = value self.next_link = next_link @@ -2073,12 +2505,12 @@ def __init__( class ResourceSkuLocationInfo(msrest.serialization.Model): """Locations and availability zones where the SKU is available. - :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] + :ivar location: Gets location of the SKU. + :vartype location: str + :ivar zones: Gets list of availability zones where the SKU is supported. + :vartype zones: list[str] + :ivar zone_details: Gets details of capabilities available to a SKU in specific zones. + :vartype zone_details: list[~azure.mgmt.appplatform.v2020_07_01.models.ResourceSkuZoneDetails] """ _attribute_map = { @@ -2095,6 +2527,15 @@ def __init__( zone_details: Optional[List["ResourceSkuZoneDetails"]] = None, **kwargs ): + """ + :keyword location: Gets location of the SKU. + :paramtype location: str + :keyword zones: Gets list of availability zones where the SKU is supported. + :paramtype zones: list[str] + :keyword zone_details: Gets details of capabilities available to a SKU in specific zones. + :paramtype zone_details: + list[~azure.mgmt.appplatform.v2020_07_01.models.ResourceSkuZoneDetails] + """ super(ResourceSkuLocationInfo, self).__init__(**kwargs) self.location = location self.zones = zones @@ -2104,10 +2545,10 @@ def __init__( class ResourceSkuRestrictionInfo(msrest.serialization.Model): """Information about the restriction where the SKU cannot be used. - :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] + :ivar locations: Gets locations where the SKU is restricted. + :vartype locations: list[str] + :ivar zones: Gets list of availability zones where the SKU is restricted. + :vartype zones: list[str] """ _attribute_map = { @@ -2122,6 +2563,12 @@ def __init__( zones: Optional[List[str]] = None, **kwargs ): + """ + :keyword locations: Gets locations where the SKU is restricted. + :paramtype locations: list[str] + :keyword zones: Gets list of availability zones where the SKU is restricted. + :paramtype zones: list[str] + """ super(ResourceSkuRestrictionInfo, self).__init__(**kwargs) self.locations = locations self.zones = zones @@ -2130,19 +2577,20 @@ def __init__( class ResourceSkuRestrictions(msrest.serialization.Model): """Restrictions where the SKU cannot be used. - :param type: Gets the type of restrictions. Possible values include: 'Location', 'Zone'. + :ivar 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 + :vartype type: str or ~azure.mgmt.appplatform.v2020_07_01.models.ResourceSkuRestrictionsType + :ivar 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 + :vartype values: list[str] + :ivar 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', + :vartype restriction_info: + ~azure.mgmt.appplatform.v2020_07_01.models.ResourceSkuRestrictionInfo + :ivar reason_code: Gets the reason for restriction. Possible values include: 'QuotaId', 'NotAvailableForSubscription'. Possible values include: "QuotaId", "NotAvailableForSubscription". - :type reason_code: str or + :vartype reason_code: str or ~azure.mgmt.appplatform.v2020_07_01.models.ResourceSkuRestrictionsReasonCode """ @@ -2162,6 +2610,23 @@ def __init__( reason_code: Optional[Union[str, "ResourceSkuRestrictionsReasonCode"]] = None, **kwargs ): + """ + :keyword type: Gets the type of restrictions. Possible values include: 'Location', 'Zone'. + Possible values include: "Location", "Zone". + :paramtype type: str or ~azure.mgmt.appplatform.v2020_07_01.models.ResourceSkuRestrictionsType + :keyword values: Gets the value of restrictions. If the restriction type is set to + location. This would be different locations where the SKU is restricted. + :paramtype values: list[str] + :keyword restriction_info: Gets the information about the restriction where the SKU cannot be + used. + :paramtype restriction_info: + ~azure.mgmt.appplatform.v2020_07_01.models.ResourceSkuRestrictionInfo + :keyword reason_code: Gets the reason for restriction. Possible values include: 'QuotaId', + 'NotAvailableForSubscription'. Possible values include: "QuotaId", + "NotAvailableForSubscription". + :paramtype reason_code: str or + ~azure.mgmt.appplatform.v2020_07_01.models.ResourceSkuRestrictionsReasonCode + """ super(ResourceSkuRestrictions, self).__init__(**kwargs) self.type = type self.values = values @@ -2172,12 +2637,12 @@ def __init__( 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 + :ivar 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 + :vartype name: list[str] + :ivar 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] + :vartype capabilities: list[~azure.mgmt.appplatform.v2020_07_01.models.ResourceSkuCapabilities] """ _attribute_map = { @@ -2192,6 +2657,15 @@ def __init__( capabilities: Optional[List["ResourceSkuCapabilities"]] = None, **kwargs ): + """ + :keyword name: Gets the set of zones that the SKU is available in with the + specified capabilities. + :paramtype name: list[str] + :keyword capabilities: Gets a list of capabilities that are available for the SKU in the + specified list of zones. + :paramtype capabilities: + list[~azure.mgmt.appplatform.v2020_07_01.models.ResourceSkuCapabilities] + """ super(ResourceSkuZoneDetails, self).__init__(**kwargs) self.name = name self.capabilities = capabilities @@ -2200,10 +2674,10 @@ def __init__( class ResourceUploadDefinition(msrest.serialization.Model): """Resource upload definition payload. - :param relative_path: Source relative path. - :type relative_path: str - :param upload_url: Upload URL. - :type upload_url: str + :ivar relative_path: Source relative path. + :vartype relative_path: str + :ivar upload_url: Upload URL. + :vartype upload_url: str """ _attribute_map = { @@ -2218,6 +2692,12 @@ def __init__( upload_url: Optional[str] = None, **kwargs ): + """ + :keyword relative_path: Source relative path. + :paramtype relative_path: str + :keyword upload_url: Upload URL. + :paramtype upload_url: str + """ super(ResourceUploadDefinition, self).__init__(**kwargs) self.relative_path = relative_path self.upload_url = upload_url @@ -2234,11 +2714,11 @@ class TrackedResource(Resource): :vartype name: str :ivar type: The type of the resource. :vartype type: str - :param location: The GEO location of the resource. - :type location: str - :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] + :ivar location: The GEO location of the resource. + :vartype location: str + :ivar tags: A set of tags. Tags of the service which is a list of key value pairs that describe + the resource. + :vartype tags: dict[str, str] """ _validation = { @@ -2262,6 +2742,13 @@ def __init__( tags: Optional[Dict[str, str]] = None, **kwargs ): + """ + :keyword location: The GEO location of the resource. + :paramtype location: str + :keyword tags: A set of tags. Tags of the service which is a list of key value pairs that + describe the resource. + :paramtype tags: dict[str, str] + """ super(TrackedResource, self).__init__(**kwargs) self.location = location self.tags = tags @@ -2278,15 +2765,15 @@ class ServiceResource(TrackedResource): :vartype name: str :ivar type: The type of the resource. :vartype type: str - :param location: The GEO location of the resource. - :type location: str - :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. - :type sku: ~azure.mgmt.appplatform.v2020_07_01.models.Sku + :ivar location: The GEO location of the resource. + :vartype location: str + :ivar tags: A set of tags. Tags of the service which is a list of key value pairs that describe + the resource. + :vartype tags: dict[str, str] + :ivar properties: Properties of the Service resource. + :vartype properties: ~azure.mgmt.appplatform.v2020_07_01.models.ClusterResourceProperties + :ivar sku: Sku of the Service resource. + :vartype sku: ~azure.mgmt.appplatform.v2020_07_01.models.Sku """ _validation = { @@ -2314,6 +2801,17 @@ def __init__( sku: Optional["Sku"] = None, **kwargs ): + """ + :keyword location: The GEO location of the resource. + :paramtype location: str + :keyword tags: A set of tags. Tags of the service which is a list of key value pairs that + describe the resource. + :paramtype tags: dict[str, str] + :keyword properties: Properties of the Service resource. + :paramtype properties: ~azure.mgmt.appplatform.v2020_07_01.models.ClusterResourceProperties + :keyword sku: Sku of the Service resource. + :paramtype sku: ~azure.mgmt.appplatform.v2020_07_01.models.Sku + """ super(ServiceResource, self).__init__(location=location, tags=tags, **kwargs) self.properties = properties self.sku = sku @@ -2322,11 +2820,11 @@ def __init__( 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). + :ivar value: Collection of Service resources. + :vartype value: list[~azure.mgmt.appplatform.v2020_07_01.models.ServiceResource] + :ivar 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 + :vartype next_link: str """ _attribute_map = { @@ -2341,6 +2839,13 @@ def __init__( next_link: Optional[str] = None, **kwargs ): + """ + :keyword value: Collection of Service resources. + :paramtype value: list[~azure.mgmt.appplatform.v2020_07_01.models.ServiceResource] + :keyword next_link: URL client should use to fetch the next page (per server side paging). + It's null for now, added for future use. + :paramtype next_link: str + """ super(ServiceResourceList, self).__init__(**kwargs) self.value = value self.next_link = next_link @@ -2349,10 +2854,10 @@ def __init__( 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. - :type metric_specifications: + :ivar log_specifications: Specifications of the Log for Azure Monitoring. + :vartype log_specifications: list[~azure.mgmt.appplatform.v2020_07_01.models.LogSpecification] + :ivar metric_specifications: Specifications of the Metrics for Azure Monitoring. + :vartype metric_specifications: list[~azure.mgmt.appplatform.v2020_07_01.models.MetricSpecification] """ @@ -2368,6 +2873,14 @@ def __init__( metric_specifications: Optional[List["MetricSpecification"]] = None, **kwargs ): + """ + :keyword log_specifications: Specifications of the Log for Azure Monitoring. + :paramtype log_specifications: + list[~azure.mgmt.appplatform.v2020_07_01.models.LogSpecification] + :keyword metric_specifications: Specifications of the Metrics for Azure Monitoring. + :paramtype metric_specifications: + list[~azure.mgmt.appplatform.v2020_07_01.models.MetricSpecification] + """ super(ServiceSpecification, self).__init__(**kwargs) self.log_specifications = log_specifications self.metric_specifications = metric_specifications @@ -2376,12 +2889,12 @@ def __init__( class Sku(msrest.serialization.Model): """Sku of Azure Spring Cloud. - :param name: Name of the Sku. - :type name: str - :param tier: Tier of the Sku. - :type tier: str - :param capacity: Current capacity of the target resource. - :type capacity: int + :ivar name: Name of the Sku. + :vartype name: str + :ivar tier: Tier of the Sku. + :vartype tier: str + :ivar capacity: Current capacity of the target resource. + :vartype capacity: int """ _attribute_map = { @@ -2398,6 +2911,14 @@ def __init__( capacity: Optional[int] = None, **kwargs ): + """ + :keyword name: Name of the Sku. + :paramtype name: str + :keyword tier: Tier of the Sku. + :paramtype tier: str + :keyword capacity: Current capacity of the target resource. + :paramtype capacity: int + """ super(Sku, self).__init__(**kwargs) self.name = name self.tier = tier @@ -2409,15 +2930,15 @@ class SkuCapacity(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param minimum: Required. Gets or sets the minimum. - :type minimum: int - :param maximum: Gets or sets the maximum. - :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", + :ivar minimum: Required. Gets or sets the minimum. + :vartype minimum: int + :ivar maximum: Gets or sets the maximum. + :vartype maximum: int + :ivar default: Gets or sets the default. + :vartype default: int + :ivar 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 + :vartype scale_type: str or ~azure.mgmt.appplatform.v2020_07_01.models.SkuScaleType """ _validation = { @@ -2440,6 +2961,17 @@ def __init__( scale_type: Optional[Union[str, "SkuScaleType"]] = None, **kwargs ): + """ + :keyword minimum: Required. Gets or sets the minimum. + :paramtype minimum: int + :keyword maximum: Gets or sets the maximum. + :paramtype maximum: int + :keyword default: Gets or sets the default. + :paramtype default: int + :keyword scale_type: Gets or sets the type of the scale. Possible values include: "None", + "Manual", "Automatic". + :paramtype scale_type: str or ~azure.mgmt.appplatform.v2020_07_01.models.SkuScaleType + """ super(SkuCapacity, self).__init__(**kwargs) self.minimum = minimum self.maximum = maximum @@ -2450,14 +2982,14 @@ def __init__( 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"). + :ivar value: The raw value which could be passed to deployment CRUD operations. Possible values + include: "Java_8", "Java_11", "NetCore_31". + :vartype value: str or ~azure.mgmt.appplatform.v2020_07_01.models.SupportedRuntimeValue + :ivar 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 + :vartype platform: str or ~azure.mgmt.appplatform.v2020_07_01.models.SupportedRuntimePlatform + :ivar version: The detailed version (major.minor) of the platform. + :vartype version: str """ _attribute_map = { @@ -2474,6 +3006,16 @@ def __init__( version: Optional[str] = None, **kwargs ): + """ + :keyword value: The raw value which could be passed to deployment CRUD operations. Possible + values include: "Java_8", "Java_11", "NetCore_31". + :paramtype value: str or ~azure.mgmt.appplatform.v2020_07_01.models.SupportedRuntimeValue + :keyword platform: The platform of this runtime version (possible values: "Java" or ".NET"). + Possible values include: "Java", ".NET Core". + :paramtype platform: str or ~azure.mgmt.appplatform.v2020_07_01.models.SupportedRuntimePlatform + :keyword version: The detailed version (major.minor) of the platform. + :paramtype version: str + """ super(SupportedRuntimeVersion, self).__init__(**kwargs) self.value = value self.platform = platform @@ -2483,10 +3025,10 @@ def __init__( class TemporaryDisk(msrest.serialization.Model): """Temporary disk payload. - :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. - :type mount_path: str + :ivar size_in_gb: Size of the temporary disk in GB. + :vartype size_in_gb: int + :ivar mount_path: Mount path of the temporary disk. + :vartype mount_path: str """ _validation = { @@ -2505,6 +3047,12 @@ def __init__( mount_path: Optional[str] = "/tmp", **kwargs ): + """ + :keyword size_in_gb: Size of the temporary disk in GB. + :paramtype size_in_gb: int + :keyword mount_path: Mount path of the temporary disk. + :paramtype mount_path: str + """ super(TemporaryDisk, self).__init__(**kwargs) self.size_in_gb = size_in_gb self.mount_path = mount_path @@ -2513,16 +3061,16 @@ def __init__( class TestKeys(msrest.serialization.Model): """Test keys payload. - :param primary_key: Primary key. - :type primary_key: str - :param secondary_key: Secondary key. - :type secondary_key: str - :param primary_test_endpoint: Primary test endpoint. - :type primary_test_endpoint: str - :param secondary_test_endpoint: Secondary test endpoint. - :type secondary_test_endpoint: str - :param enabled: Indicates whether the test endpoint feature enabled or not. - :type enabled: bool + :ivar primary_key: Primary key. + :vartype primary_key: str + :ivar secondary_key: Secondary key. + :vartype secondary_key: str + :ivar primary_test_endpoint: Primary test endpoint. + :vartype primary_test_endpoint: str + :ivar secondary_test_endpoint: Secondary test endpoint. + :vartype secondary_test_endpoint: str + :ivar enabled: Indicates whether the test endpoint feature enabled or not. + :vartype enabled: bool """ _attribute_map = { @@ -2543,6 +3091,18 @@ def __init__( enabled: Optional[bool] = None, **kwargs ): + """ + :keyword primary_key: Primary key. + :paramtype primary_key: str + :keyword secondary_key: Secondary key. + :paramtype secondary_key: str + :keyword primary_test_endpoint: Primary test endpoint. + :paramtype primary_test_endpoint: str + :keyword secondary_test_endpoint: Secondary test endpoint. + :paramtype secondary_test_endpoint: str + :keyword enabled: Indicates whether the test endpoint feature enabled or not. + :paramtype enabled: bool + """ super(TestKeys, self).__init__(**kwargs) self.primary_key = primary_key self.secondary_key = secondary_key @@ -2554,17 +3114,17 @@ def __init__( class UserSourceInfo(msrest.serialization.Model): """Source information for a deployment. - :param type: Type of the source uploaded. Possible values include: "Jar", "NetCoreZip", + :ivar 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. - :type version: str - :param artifact_selector: Selector for the artifact to be used for the deployment for + :vartype type: str or ~azure.mgmt.appplatform.v2020_07_01.models.UserSourceType + :ivar relative_path: Relative path of the storage which stores the source. + :vartype relative_path: str + :ivar version: Version of the source. + :vartype version: str + :ivar 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 + :vartype artifact_selector: str """ _attribute_map = { @@ -2583,6 +3143,19 @@ def __init__( artifact_selector: Optional[str] = None, **kwargs ): + """ + :keyword type: Type of the source uploaded. Possible values include: "Jar", "NetCoreZip", + "Source". + :paramtype type: str or ~azure.mgmt.appplatform.v2020_07_01.models.UserSourceType + :keyword relative_path: Relative path of the storage which stores the source. + :paramtype relative_path: str + :keyword version: Version of the source. + :paramtype version: str + :keyword 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. + :paramtype artifact_selector: str + """ super(UserSourceInfo, self).__init__(**kwargs) self.type = type self.relative_path = relative_path diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2020_07_01/operations/_apps_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2020_07_01/operations/_apps_operations.py index 5be695c736403..e9b084cd5f5ed 100644 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2020_07_01/operations/_apps_operations.py +++ b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2020_07_01/operations/_apps_operations.py @@ -5,26 +5,314 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools from typing import TYPE_CHECKING import warnings 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.pipeline.transport import HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling +from msrest import Serializer from .. import models as _models +from .._vendor import _convert_request, _format_url_section 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]] +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False +# fmt: off + +def build_get_request( + subscription_id, # type: str + resource_group_name, # type: str + service_name, # type: str + app_name, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + sync_status = kwargs.pop('sync_status', None) # type: Optional[str] + + api_version = "2020-07-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), + "appName": _SERIALIZER.url("app_name", app_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + if sync_status is not None: + query_parameters['syncStatus'] = _SERIALIZER.query("sync_status", sync_status, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_create_or_update_request_initial( + subscription_id, # type: str + resource_group_name, # type: str + service_name, # type: str + app_name, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2020-07-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), + "appName": _SERIALIZER.url("app_name", app_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_delete_request_initial( + subscription_id, # type: str + resource_group_name, # type: str + service_name, # type: str + app_name, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + api_version = "2020-07-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), + "appName": _SERIALIZER.url("app_name", app_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="DELETE", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_update_request_initial( + subscription_id, # type: str + resource_group_name, # type: str + service_name, # type: str + app_name, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2020-07-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), + "appName": _SERIALIZER.url("app_name", app_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PATCH", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_list_request( + subscription_id, # type: str + resource_group_name, # type: str + service_name, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + api_version = "2020-07-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_get_resource_upload_url_request( + subscription_id, # type: str + resource_group_name, # type: str + service_name, # type: str + app_name, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + api_version = "2020-07-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/getResourceUploadUrl') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), + "appName": _SERIALIZER.url("app_name", app_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_validate_domain_request( + subscription_id, # type: str + resource_group_name, # type: str + service_name, # type: str + app_name, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2020-07-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/validateDomain') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), + "appName": _SERIALIZER.url("app_name", app_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + +# fmt: on class AppsOperations(object): """AppsOperations operations. @@ -47,6 +335,7 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def get( self, resource_group_name, # type: str @@ -77,30 +366,19 @@ def get( 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 = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + sync_status=sync_status, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -114,8 +392,10 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized + 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, # type: str @@ -130,33 +410,23 @@ def _create_or_update_initial( 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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = self._serialize.body(app_resource, 'AppResource') + + request = build_create_or_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -177,8 +447,11 @@ def _create_or_update_initial( 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 + + @distributed_trace def begin_create_or_update( self, resource_group_name, # type: str @@ -201,15 +474,19 @@ def begin_create_or_update( :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. + :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) + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.AppResource"] lro_delay = kwargs.pop( 'polling_interval', @@ -222,28 +499,21 @@ def begin_create_or_update( service_name=service_name, app_name=app_name, app_resource=app_resource, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_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 = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -255,6 +525,7 @@ def get_long_running_output(pipeline_response): ) 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( @@ -270,28 +541,18 @@ def _delete_initial( 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 = build_delete_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -304,6 +565,8 @@ def _delete_initial( _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}'} # type: ignore + + @distributed_trace def begin_delete( self, resource_group_name, # type: str @@ -323,15 +586,17 @@ def begin_delete( :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 ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :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. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -346,22 +611,14 @@ def begin_delete( 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 = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -373,6 +630,7 @@ def get_long_running_output(pipeline_response): ) 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( @@ -389,33 +647,23 @@ def _update_initial( 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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(app_resource, 'AppResource') - # 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') + request = build_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + content_type=content_type, + json=_json, + template_url=self._update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -433,8 +681,11 @@ def _update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}'} # type: ignore + + @distributed_trace def begin_update( self, resource_group_name, # type: str @@ -457,15 +708,19 @@ def begin_update( :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. + :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) + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.AppResource"] lro_delay = kwargs.pop( 'polling_interval', @@ -478,28 +733,21 @@ def begin_update( service_name=service_name, app_name=app_name, app_resource=app_resource, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_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 = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -511,8 +759,10 @@ def get_long_running_output(pipeline_response): ) 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 + @distributed_trace def list( self, resource_group_name, # type: str @@ -528,8 +778,10 @@ def list( :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.paging.ItemPaged[~azure.mgmt.appplatform.v2020_07_01.models.AppResourceCollection] + :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"] @@ -537,36 +789,33 @@ def list( 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) + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('AppResourceCollection', pipeline_response) + deserialized = self._deserialize("AppResourceCollection", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -584,11 +833,13 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps'} # type: ignore + @distributed_trace def get_resource_upload_url( self, resource_group_name, # type: str @@ -616,28 +867,18 @@ def get_resource_upload_url( 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 = build_get_resource_upload_url_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + template_url=self.get_resource_upload_url.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -651,8 +892,11 @@ def get_resource_upload_url( 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 + + @distributed_trace def validate_domain( self, resource_group_name, # type: str @@ -683,33 +927,23 @@ def validate_domain( 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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(validate_payload, 'CustomDomainValidatePayload') - # 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') + request = build_validate_domain_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + content_type=content_type, + json=_json, + template_url=self.validate_domain.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -723,4 +957,6 @@ def validate_domain( 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/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2020_07_01/operations/_bindings_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2020_07_01/operations/_bindings_operations.py index 4d01d1bab1290..fa0aa1c2a7b2d 100644 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2020_07_01/operations/_bindings_operations.py +++ b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2020_07_01/operations/_bindings_operations.py @@ -5,26 +5,240 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools from typing import TYPE_CHECKING import warnings 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.pipeline.transport import HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling +from msrest import Serializer from .. import models as _models +from .._vendor import _convert_request, _format_url_section 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]] +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False +# fmt: off + +def build_get_request( + subscription_id, # type: str + resource_group_name, # type: str + service_name, # type: str + app_name, # type: str + binding_name, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + api_version = "2020-07-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/bindings/{bindingName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), + "appName": _SERIALIZER.url("app_name", app_name, 'str'), + "bindingName": _SERIALIZER.url("binding_name", binding_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_create_or_update_request_initial( + subscription_id, # type: str + resource_group_name, # type: str + service_name, # type: str + app_name, # type: str + binding_name, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2020-07-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/bindings/{bindingName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), + "appName": _SERIALIZER.url("app_name", app_name, 'str'), + "bindingName": _SERIALIZER.url("binding_name", binding_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_delete_request_initial( + subscription_id, # type: str + resource_group_name, # type: str + service_name, # type: str + app_name, # type: str + binding_name, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + api_version = "2020-07-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/bindings/{bindingName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), + "appName": _SERIALIZER.url("app_name", app_name, 'str'), + "bindingName": _SERIALIZER.url("binding_name", binding_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="DELETE", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_update_request_initial( + subscription_id, # type: str + resource_group_name, # type: str + service_name, # type: str + app_name, # type: str + binding_name, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2020-07-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/bindings/{bindingName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), + "appName": _SERIALIZER.url("app_name", app_name, 'str'), + "bindingName": _SERIALIZER.url("binding_name", binding_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PATCH", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_list_request( + subscription_id, # type: str + resource_group_name, # type: str + service_name, # type: str + app_name, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + api_version = "2020-07-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/bindings') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), + "appName": _SERIALIZER.url("app_name", app_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + +# fmt: on class BindingsOperations(object): """BindingsOperations operations. @@ -47,6 +261,7 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def get( self, resource_group_name, # type: str @@ -77,29 +292,19 @@ def get( 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 = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + binding_name=binding_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -113,8 +318,10 @@ def get( 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 + def _create_or_update_initial( self, resource_group_name, # type: str @@ -130,34 +337,24 @@ def _create_or_update_initial( 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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = self._serialize.body(binding_resource, 'BindingResource') + + request = build_create_or_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + binding_name=binding_name, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -178,8 +375,11 @@ def _create_or_update_initial( 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 + + @distributed_trace def begin_create_or_update( self, resource_group_name, # type: str @@ -205,15 +405,20 @@ def begin_create_or_update( :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. + :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: + :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 """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.BindingResource"] lro_delay = kwargs.pop( 'polling_interval', @@ -227,29 +432,21 @@ def begin_create_or_update( app_name=app_name, binding_name=binding_name, binding_resource=binding_resource, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_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 = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -261,6 +458,7 @@ def get_long_running_output(pipeline_response): ) 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( @@ -277,29 +475,19 @@ def _delete_initial( 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 = build_delete_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + binding_name=binding_name, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -312,6 +500,8 @@ def _delete_initial( _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/bindings/{bindingName}'} # type: ignore + + @distributed_trace def begin_delete( self, resource_group_name, # type: str @@ -334,15 +524,17 @@ def begin_delete( :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 ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :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. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -358,23 +550,14 @@ def begin_delete( 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 = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -386,6 +569,7 @@ def get_long_running_output(pipeline_response): ) 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( @@ -403,34 +587,24 @@ def _update_initial( 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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(binding_resource, 'BindingResource') - # 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') + request = build_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + binding_name=binding_name, + content_type=content_type, + json=_json, + template_url=self._update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -448,8 +622,11 @@ def _update_initial( 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 + + @distributed_trace def begin_update( self, resource_group_name, # type: str @@ -475,15 +652,20 @@ def begin_update( :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. + :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: + :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 """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.BindingResource"] lro_delay = kwargs.pop( 'polling_interval', @@ -497,29 +679,21 @@ def begin_update( app_name=app_name, binding_name=binding_name, binding_resource=binding_resource, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_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 = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -531,8 +705,10 @@ def get_long_running_output(pipeline_response): ) 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 + @distributed_trace def list( self, resource_group_name, # type: str @@ -551,8 +727,10 @@ def list( :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.paging.ItemPaged[~azure.mgmt.appplatform.v2020_07_01.models.BindingResourceCollection] + :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"] @@ -560,37 +738,35 @@ def list( 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) + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('BindingResourceCollection', pipeline_response) + deserialized = self._deserialize("BindingResourceCollection", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -608,6 +784,7 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2020_07_01/operations/_certificates_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2020_07_01/operations/_certificates_operations.py index f60d181ac484c..75e194b8d8079 100644 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2020_07_01/operations/_certificates_operations.py +++ b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2020_07_01/operations/_certificates_operations.py @@ -5,26 +5,188 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools from typing import TYPE_CHECKING import warnings 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.pipeline.transport import HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling +from msrest import Serializer from .. import models as _models +from .._vendor import _convert_request, _format_url_section 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]] +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False +# fmt: off + +def build_get_request( + subscription_id, # type: str + resource_group_name, # type: str + service_name, # type: str + certificate_name, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + api_version = "2020-07-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/certificates/{certificateName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), + "certificateName": _SERIALIZER.url("certificate_name", certificate_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_create_or_update_request_initial( + subscription_id, # type: str + resource_group_name, # type: str + service_name, # type: str + certificate_name, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2020-07-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/certificates/{certificateName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), + "certificateName": _SERIALIZER.url("certificate_name", certificate_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_delete_request_initial( + subscription_id, # type: str + resource_group_name, # type: str + service_name, # type: str + certificate_name, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + api_version = "2020-07-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/certificates/{certificateName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), + "certificateName": _SERIALIZER.url("certificate_name", certificate_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="DELETE", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_list_request( + subscription_id, # type: str + resource_group_name, # type: str + service_name, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + api_version = "2020-07-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/certificates') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + +# fmt: on class CertificatesOperations(object): """CertificatesOperations operations. @@ -47,6 +209,7 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def get( self, resource_group_name, # type: str @@ -74,28 +237,18 @@ def get( 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 = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + certificate_name=certificate_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -109,8 +262,10 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized + 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, # type: str @@ -125,33 +280,23 @@ def _create_or_update_initial( 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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = self._serialize.body(certificate_resource, 'CertificateResource') + + request = build_create_or_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + certificate_name=certificate_name, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -172,8 +317,11 @@ def _create_or_update_initial( 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 + + @distributed_trace def begin_create_or_update( self, resource_group_name, # type: str @@ -196,15 +344,20 @@ def begin_create_or_update( :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. + :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: + :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 """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.CertificateResource"] lro_delay = kwargs.pop( 'polling_interval', @@ -217,28 +370,21 @@ def begin_create_or_update( service_name=service_name, certificate_name=certificate_name, certificate_resource=certificate_resource, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_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 = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -250,6 +396,7 @@ def get_long_running_output(pipeline_response): ) 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( @@ -265,28 +412,18 @@ def _delete_initial( 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 = build_delete_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + certificate_name=certificate_name, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -299,6 +436,8 @@ def _delete_initial( _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/certificates/{certificateName}'} # type: ignore + + @distributed_trace def begin_delete( self, resource_group_name, # type: str @@ -318,15 +457,17 @@ def begin_delete( :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 ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :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. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -341,22 +482,14 @@ def begin_delete( 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 = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -368,8 +501,10 @@ def get_long_running_output(pipeline_response): ) 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 + @distributed_trace def list( self, resource_group_name, # type: str @@ -385,8 +520,10 @@ def list( :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.paging.ItemPaged[~azure.mgmt.appplatform.v2020_07_01.models.CertificateResourceCollection] + :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"] @@ -394,36 +531,33 @@ def list( 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) + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('CertificateResourceCollection', pipeline_response) + deserialized = self._deserialize("CertificateResourceCollection", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -441,6 +575,7 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2020_07_01/operations/_config_servers_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2020_07_01/operations/_config_servers_operations.py index c4dfb55f98b45..e70ed84a936d9 100644 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2020_07_01/operations/_config_servers_operations.py +++ b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2020_07_01/operations/_config_servers_operations.py @@ -5,25 +5,189 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools from typing import TYPE_CHECKING 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 HttpRequest, HttpResponse +from azure.core.pipeline.transport import HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling +from msrest import Serializer from .. import models as _models +from .._vendor import _convert_request, _format_url_section 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]] +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False +# fmt: off + +def build_get_request( + subscription_id, # type: str + resource_group_name, # type: str + service_name, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + api_version = "2020-07-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configServers/default') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_update_put_request_initial( + subscription_id, # type: str + resource_group_name, # type: str + service_name, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2020-07-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configServers/default') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_update_patch_request_initial( + subscription_id, # type: str + resource_group_name, # type: str + service_name, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2020-07-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configServers/default') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PATCH", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_validate_request_initial( + subscription_id, # type: str + resource_group_name, # type: str + service_name, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2020-07-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configServers/validate') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + +# fmt: on class ConfigServersOperations(object): """ConfigServersOperations operations. @@ -46,6 +210,7 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def get( self, resource_group_name, # type: str @@ -70,27 +235,17 @@ def get( 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 = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -104,8 +259,10 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configServers/default'} # type: ignore + def _update_put_initial( self, resource_group_name, # type: str @@ -119,32 +276,22 @@ def _update_put_initial( 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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = self._serialize.body(config_server_resource, 'ConfigServerResource') + + request = build_update_put_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + content_type=content_type, + json=_json, + template_url=self._update_put_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -162,8 +309,11 @@ def _update_put_initial( 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 + + @distributed_trace def begin_update_put( self, resource_group_name, # type: str @@ -183,15 +333,20 @@ def begin_update_put( :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. + :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: + :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 """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.ConfigServerResource"] lro_delay = kwargs.pop( 'polling_interval', @@ -203,27 +358,21 @@ def begin_update_put( resource_group_name=resource_group_name, service_name=service_name, config_server_resource=config_server_resource, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_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 = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -235,6 +384,7 @@ def get_long_running_output(pipeline_response): ) 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( @@ -250,32 +400,22 @@ def _update_patch_initial( 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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(config_server_resource, 'ConfigServerResource') - # 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') + request = build_update_patch_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + content_type=content_type, + json=_json, + template_url=self._update_patch_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -293,8 +433,11 @@ def _update_patch_initial( 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 + + @distributed_trace def begin_update_patch( self, resource_group_name, # type: str @@ -314,15 +457,20 @@ def begin_update_patch( :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. + :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: + :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 """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.ConfigServerResource"] lro_delay = kwargs.pop( 'polling_interval', @@ -334,27 +482,21 @@ def begin_update_patch( resource_group_name=resource_group_name, service_name=service_name, config_server_resource=config_server_resource, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_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 = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -366,6 +508,7 @@ def get_long_running_output(pipeline_response): ) 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( @@ -381,32 +524,22 @@ def _validate_initial( 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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = self._serialize.body(config_server_settings, 'ConfigServerSettings') + + request = build_validate_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + content_type=content_type, + json=_json, + template_url=self._validate_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -424,8 +557,11 @@ def _validate_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _validate_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configServers/validate'} # type: ignore + + @distributed_trace def begin_validate( self, resource_group_name, # type: str @@ -445,15 +581,20 @@ def begin_validate( :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. + :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: + :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 """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.ConfigServerSettingsValidateResult"] lro_delay = kwargs.pop( 'polling_interval', @@ -465,27 +606,21 @@ def begin_validate( resource_group_name=resource_group_name, service_name=service_name, config_server_settings=config_server_settings, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_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 = ARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -497,4 +632,5 @@ def get_long_running_output(pipeline_response): ) 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/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2020_07_01/operations/_custom_domains_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2020_07_01/operations/_custom_domains_operations.py index 4b7051f56c714..8ce642e498b0c 100644 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2020_07_01/operations/_custom_domains_operations.py +++ b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2020_07_01/operations/_custom_domains_operations.py @@ -5,26 +5,240 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools from typing import TYPE_CHECKING import warnings 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.pipeline.transport import HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling +from msrest import Serializer from .. import models as _models +from .._vendor import _convert_request, _format_url_section 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]] +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False +# fmt: off + +def build_get_request( + subscription_id, # type: str + resource_group_name, # type: str + service_name, # type: str + app_name, # type: str + domain_name, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + api_version = "2020-07-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/domains/{domainName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), + "appName": _SERIALIZER.url("app_name", app_name, 'str'), + "domainName": _SERIALIZER.url("domain_name", domain_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_create_or_update_request_initial( + subscription_id, # type: str + resource_group_name, # type: str + service_name, # type: str + app_name, # type: str + domain_name, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2020-07-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/domains/{domainName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), + "appName": _SERIALIZER.url("app_name", app_name, 'str'), + "domainName": _SERIALIZER.url("domain_name", domain_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_delete_request_initial( + subscription_id, # type: str + resource_group_name, # type: str + service_name, # type: str + app_name, # type: str + domain_name, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + api_version = "2020-07-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/domains/{domainName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), + "appName": _SERIALIZER.url("app_name", app_name, 'str'), + "domainName": _SERIALIZER.url("domain_name", domain_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="DELETE", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_update_request_initial( + subscription_id, # type: str + resource_group_name, # type: str + service_name, # type: str + app_name, # type: str + domain_name, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2020-07-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/domains/{domainName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), + "appName": _SERIALIZER.url("app_name", app_name, 'str'), + "domainName": _SERIALIZER.url("domain_name", domain_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PATCH", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_list_request( + subscription_id, # type: str + resource_group_name, # type: str + service_name, # type: str + app_name, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + api_version = "2020-07-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/domains') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), + "appName": _SERIALIZER.url("app_name", app_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + +# fmt: on class CustomDomainsOperations(object): """CustomDomainsOperations operations. @@ -47,6 +261,7 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def get( self, resource_group_name, # type: str @@ -77,29 +292,19 @@ def get( 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 = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + domain_name=domain_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -113,8 +318,10 @@ def get( 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 + def _create_or_update_initial( self, resource_group_name, # type: str @@ -130,34 +337,24 @@ def _create_or_update_initial( 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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = self._serialize.body(domain_resource, 'CustomDomainResource') + + request = build_create_or_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + domain_name=domain_name, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -178,8 +375,11 @@ def _create_or_update_initial( 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 + + @distributed_trace def begin_create_or_update( self, resource_group_name, # type: str @@ -205,15 +405,20 @@ def begin_create_or_update( :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. + :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: + :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 """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.CustomDomainResource"] lro_delay = kwargs.pop( 'polling_interval', @@ -227,29 +432,21 @@ def begin_create_or_update( app_name=app_name, domain_name=domain_name, domain_resource=domain_resource, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_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 = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -261,6 +458,7 @@ def get_long_running_output(pipeline_response): ) 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( @@ -277,29 +475,19 @@ def _delete_initial( 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 = build_delete_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + domain_name=domain_name, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -312,6 +500,8 @@ def _delete_initial( _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/domains/{domainName}'} # type: ignore + + @distributed_trace def begin_delete( self, resource_group_name, # type: str @@ -334,15 +524,17 @@ def begin_delete( :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 ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :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. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -358,23 +550,14 @@ def begin_delete( 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 = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -386,6 +569,7 @@ def get_long_running_output(pipeline_response): ) 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( @@ -403,34 +587,24 @@ def _update_initial( 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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(domain_resource, 'CustomDomainResource') - # 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') + request = build_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + domain_name=domain_name, + content_type=content_type, + json=_json, + template_url=self._update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -448,8 +622,11 @@ def _update_initial( 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 + + @distributed_trace def begin_update( self, resource_group_name, # type: str @@ -475,15 +652,20 @@ def begin_update( :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. + :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: + :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 """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.CustomDomainResource"] lro_delay = kwargs.pop( 'polling_interval', @@ -497,29 +679,21 @@ def begin_update( app_name=app_name, domain_name=domain_name, domain_resource=domain_resource, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_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 = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -531,8 +705,10 @@ def get_long_running_output(pipeline_response): ) 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 + @distributed_trace def list( self, resource_group_name, # type: str @@ -551,8 +727,10 @@ def list( :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.paging.ItemPaged[~azure.mgmt.appplatform.v2020_07_01.models.CustomDomainResourceCollection] + :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"] @@ -560,37 +738,35 @@ def list( 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) + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('CustomDomainResourceCollection', pipeline_response) + deserialized = self._deserialize("CustomDomainResourceCollection", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -608,6 +784,7 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2020_07_01/operations/_deployments_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2020_07_01/operations/_deployments_operations.py index 7c9649aea65b4..09c20cb413f08 100644 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2020_07_01/operations/_deployments_operations.py +++ b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2020_07_01/operations/_deployments_operations.py @@ -5,26 +5,444 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools from typing import TYPE_CHECKING import warnings 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.pipeline.transport import HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling +from msrest import Serializer from .. import models as _models +from .._vendor import _convert_request, _format_url_section 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]] +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False +# fmt: off + +def build_get_request( + subscription_id, # type: str + resource_group_name, # type: str + service_name, # type: str + app_name, # type: str + deployment_name, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + api_version = "2020-07-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), + "appName": _SERIALIZER.url("app_name", app_name, 'str'), + "deploymentName": _SERIALIZER.url("deployment_name", deployment_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_create_or_update_request_initial( + subscription_id, # type: str + resource_group_name, # type: str + service_name, # type: str + app_name, # type: str + deployment_name, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2020-07-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), + "appName": _SERIALIZER.url("app_name", app_name, 'str'), + "deploymentName": _SERIALIZER.url("deployment_name", deployment_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_delete_request_initial( + subscription_id, # type: str + resource_group_name, # type: str + service_name, # type: str + app_name, # type: str + deployment_name, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + api_version = "2020-07-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), + "appName": _SERIALIZER.url("app_name", app_name, 'str'), + "deploymentName": _SERIALIZER.url("deployment_name", deployment_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="DELETE", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_update_request_initial( + subscription_id, # type: str + resource_group_name, # type: str + service_name, # type: str + app_name, # type: str + deployment_name, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2020-07-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), + "appName": _SERIALIZER.url("app_name", app_name, 'str'), + "deploymentName": _SERIALIZER.url("deployment_name", deployment_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PATCH", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_list_request( + subscription_id, # type: str + resource_group_name, # type: str + service_name, # type: str + app_name, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + version = kwargs.pop('version', None) # type: Optional[List[str]] + + api_version = "2020-07-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), + "appName": _SERIALIZER.url("app_name", app_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + if version is not None: + query_parameters['version'] = [_SERIALIZER.query("version", q, 'str') if q is not None else '' for q in version] + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_list_for_cluster_request( + subscription_id, # type: str + resource_group_name, # type: str + service_name, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + version = kwargs.pop('version', None) # type: Optional[List[str]] + + api_version = "2020-07-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/deployments') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + if version is not None: + query_parameters['version'] = [_SERIALIZER.query("version", q, 'str') if q is not None else '' for q in version] + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_start_request_initial( + subscription_id, # type: str + resource_group_name, # type: str + service_name, # type: str + app_name, # type: str + deployment_name, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + api_version = "2020-07-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/start') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), + "appName": _SERIALIZER.url("app_name", app_name, 'str'), + "deploymentName": _SERIALIZER.url("deployment_name", deployment_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_stop_request_initial( + subscription_id, # type: str + resource_group_name, # type: str + service_name, # type: str + app_name, # type: str + deployment_name, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + api_version = "2020-07-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/stop') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), + "appName": _SERIALIZER.url("app_name", app_name, 'str'), + "deploymentName": _SERIALIZER.url("deployment_name", deployment_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_restart_request_initial( + subscription_id, # type: str + resource_group_name, # type: str + service_name, # type: str + app_name, # type: str + deployment_name, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + api_version = "2020-07-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/restart') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), + "appName": _SERIALIZER.url("app_name", app_name, 'str'), + "deploymentName": _SERIALIZER.url("deployment_name", deployment_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_get_log_file_url_request( + subscription_id, # type: str + resource_group_name, # type: str + service_name, # type: str + app_name, # type: str + deployment_name, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + api_version = "2020-07-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/getLogFileUrl') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), + "appName": _SERIALIZER.url("app_name", app_name, 'str'), + "deploymentName": _SERIALIZER.url("deployment_name", deployment_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + +# fmt: on class DeploymentsOperations(object): """DeploymentsOperations operations. @@ -47,6 +465,7 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def get( self, resource_group_name, # type: str @@ -77,29 +496,19 @@ def get( 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 = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + deployment_name=deployment_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -113,8 +522,10 @@ def get( 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 + def _create_or_update_initial( self, resource_group_name, # type: str @@ -130,34 +541,24 @@ def _create_or_update_initial( 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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = self._serialize.body(deployment_resource, 'DeploymentResource') + + request = build_create_or_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + deployment_name=deployment_name, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -178,8 +579,11 @@ def _create_or_update_initial( 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 + + @distributed_trace def begin_create_or_update( self, resource_group_name, # type: str @@ -205,15 +609,20 @@ def begin_create_or_update( :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. + :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: + :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 """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.DeploymentResource"] lro_delay = kwargs.pop( 'polling_interval', @@ -227,29 +636,21 @@ def begin_create_or_update( app_name=app_name, deployment_name=deployment_name, deployment_resource=deployment_resource, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_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 = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -261,6 +662,7 @@ def get_long_running_output(pipeline_response): ) 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( @@ -277,29 +679,19 @@ def _delete_initial( 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 = build_delete_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + deployment_name=deployment_name, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -312,6 +704,8 @@ def _delete_initial( _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}'} # type: ignore + + @distributed_trace def begin_delete( self, resource_group_name, # type: str @@ -334,15 +728,17 @@ def begin_delete( :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 ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :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. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -358,23 +754,14 @@ def begin_delete( 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 = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -386,6 +773,7 @@ def get_long_running_output(pipeline_response): ) 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( @@ -403,34 +791,24 @@ def _update_initial( 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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = self._serialize.body(deployment_resource, 'DeploymentResource') + + request = build_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + deployment_name=deployment_name, + content_type=content_type, + json=_json, + template_url=self._update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -448,8 +826,11 @@ def _update_initial( 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 + + @distributed_trace def begin_update( self, resource_group_name, # type: str @@ -475,15 +856,20 @@ def begin_update( :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. + :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: + :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 """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.DeploymentResource"] lro_delay = kwargs.pop( 'polling_interval', @@ -497,29 +883,21 @@ def begin_update( app_name=app_name, deployment_name=deployment_name, deployment_resource=deployment_resource, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_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 = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -531,8 +909,10 @@ def get_long_running_output(pipeline_response): ) 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 + @distributed_trace def list( self, resource_group_name, # type: str @@ -554,8 +934,10 @@ def list( :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.paging.ItemPaged[~azure.mgmt.appplatform.v2020_07_01.models.DeploymentResourceCollection] + :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"] @@ -563,39 +945,37 @@ def list( 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) + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + version=version, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + version=version, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('DeploymentResourceCollection', pipeline_response) + deserialized = self._deserialize("DeploymentResourceCollection", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -613,11 +993,13 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments'} # type: ignore + @distributed_trace def list_for_cluster( self, resource_group_name, # type: str @@ -636,8 +1018,10 @@ def list_for_cluster( :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.paging.ItemPaged[~azure.mgmt.appplatform.v2020_07_01.models.DeploymentResourceCollection] + :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"] @@ -645,38 +1029,35 @@ def list_for_cluster( 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) + + request = build_list_for_cluster_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + version=version, + template_url=self.list_for_cluster.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_for_cluster_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + version=version, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('DeploymentResourceCollection', pipeline_response) + deserialized = self._deserialize("DeploymentResourceCollection", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -694,6 +1075,7 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) @@ -713,29 +1095,19 @@ def _start_initial( 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 = build_start_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + deployment_name=deployment_name, + template_url=self._start_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -748,6 +1120,8 @@ def _start_initial( _start_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/start'} # type: ignore + + @distributed_trace def begin_start( self, resource_group_name, # type: str @@ -770,15 +1144,17 @@ def begin_start( :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 ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :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. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -794,23 +1170,14 @@ def begin_start( 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 = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -822,6 +1189,7 @@ def get_long_running_output(pipeline_response): ) 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( @@ -838,29 +1206,19 @@ def _stop_initial( 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 = build_stop_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + deployment_name=deployment_name, + template_url=self._stop_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -873,6 +1231,8 @@ def _stop_initial( _stop_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/stop'} # type: ignore + + @distributed_trace def begin_stop( self, resource_group_name, # type: str @@ -895,15 +1255,17 @@ def begin_stop( :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 ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :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. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -919,23 +1281,14 @@ def begin_stop( 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 = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -947,6 +1300,7 @@ def get_long_running_output(pipeline_response): ) 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( @@ -963,29 +1317,19 @@ def _restart_initial( 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 = build_restart_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + deployment_name=deployment_name, + template_url=self._restart_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -998,6 +1342,8 @@ def _restart_initial( _restart_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/restart'} # type: ignore + + @distributed_trace def begin_restart( self, resource_group_name, # type: str @@ -1020,15 +1366,17 @@ def begin_restart( :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 ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :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. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -1044,23 +1392,14 @@ def begin_restart( 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 = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -1072,8 +1411,10 @@ def get_long_running_output(pipeline_response): ) 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 + @distributed_trace def get_log_file_url( self, resource_group_name, # type: str @@ -1104,29 +1445,19 @@ def get_log_file_url( 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 = build_get_log_file_url_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + deployment_name=deployment_name, + template_url=self.get_log_file_url.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -1142,4 +1473,6 @@ def get_log_file_url( 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/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2020_07_01/operations/_monitoring_settings_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2020_07_01/operations/_monitoring_settings_operations.py index 417872e32c66c..6b599128e4b1a 100644 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2020_07_01/operations/_monitoring_settings_operations.py +++ b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2020_07_01/operations/_monitoring_settings_operations.py @@ -5,25 +5,149 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools from typing import TYPE_CHECKING 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 HttpRequest, HttpResponse +from azure.core.pipeline.transport import HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling +from msrest import Serializer from .. import models as _models +from .._vendor import _convert_request, _format_url_section 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]] +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False +# fmt: off + +def build_get_request( + subscription_id, # type: str + resource_group_name, # type: str + service_name, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + api_version = "2020-07-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/monitoringSettings/default') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_update_put_request_initial( + subscription_id, # type: str + resource_group_name, # type: str + service_name, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2020-07-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/monitoringSettings/default') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_update_patch_request_initial( + subscription_id, # type: str + resource_group_name, # type: str + service_name, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2020-07-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/monitoringSettings/default') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PATCH", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + +# fmt: on class MonitoringSettingsOperations(object): """MonitoringSettingsOperations operations. @@ -46,6 +170,7 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def get( self, resource_group_name, # type: str @@ -70,27 +195,17 @@ def get( 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 = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -104,8 +219,10 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/monitoringSettings/default'} # type: ignore + def _update_put_initial( self, resource_group_name, # type: str @@ -119,32 +236,22 @@ def _update_put_initial( 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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = self._serialize.body(monitoring_setting_resource, 'MonitoringSettingResource') + + request = build_update_put_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + content_type=content_type, + json=_json, + template_url=self._update_put_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -162,8 +269,11 @@ def _update_put_initial( 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 + + @distributed_trace def begin_update_put( self, resource_group_name, # type: str @@ -180,18 +290,24 @@ def begin_update_put( :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 + :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. + :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: + :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 """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.MonitoringSettingResource"] lro_delay = kwargs.pop( 'polling_interval', @@ -203,27 +319,21 @@ def begin_update_put( resource_group_name=resource_group_name, service_name=service_name, monitoring_setting_resource=monitoring_setting_resource, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_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 = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -235,6 +345,7 @@ def get_long_running_output(pipeline_response): ) 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( @@ -250,32 +361,22 @@ def _update_patch_initial( 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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = self._serialize.body(monitoring_setting_resource, 'MonitoringSettingResource') + + request = build_update_patch_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + content_type=content_type, + json=_json, + template_url=self._update_patch_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -293,8 +394,11 @@ def _update_patch_initial( 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 + + @distributed_trace def begin_update_patch( self, resource_group_name, # type: str @@ -311,18 +415,24 @@ def begin_update_patch( :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 + :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. + :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: + :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 """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.MonitoringSettingResource"] lro_delay = kwargs.pop( 'polling_interval', @@ -334,27 +444,21 @@ def begin_update_patch( resource_group_name=resource_group_name, service_name=service_name, monitoring_setting_resource=monitoring_setting_resource, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_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 = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -366,4 +470,5 @@ def get_long_running_output(pipeline_response): ) 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/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2020_07_01/operations/_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2020_07_01/operations/_operations.py index 8805b70721687..3e55b685cf7c9 100644 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2020_07_01/operations/_operations.py +++ b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2020_07_01/operations/_operations.py @@ -5,24 +5,58 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools from typing import TYPE_CHECKING import warnings 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.pipeline.transport import HttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat +from msrest import Serializer from .. import models as _models +from .._vendor import _convert_request 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]] +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False +# fmt: off + +def build_list_request( + **kwargs # type: Any +): + # type: (...) -> HttpRequest + api_version = "2020-07-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/providers/Microsoft.AppPlatform/operations') + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + +# fmt: on class Operations(object): """Operations operations. @@ -45,6 +79,7 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def list( self, **kwargs # type: Any @@ -54,7 +89,8 @@ def list( :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] + :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"] @@ -62,30 +98,27 @@ def list( 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 = build_list_request( + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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) + + request = build_list_request( + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('AvailableOperations', pipeline_response) + deserialized = self._deserialize("AvailableOperations", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -103,6 +136,7 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2020_07_01/operations/_runtime_versions_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2020_07_01/operations/_runtime_versions_operations.py index 0833e31703964..1b101ffb8cbb2 100644 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2020_07_01/operations/_runtime_versions_operations.py +++ b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2020_07_01/operations/_runtime_versions_operations.py @@ -5,23 +5,57 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools from typing import TYPE_CHECKING 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 HttpRequest, HttpResponse +from azure.core.pipeline.transport import HttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat +from msrest import Serializer from .. import models as _models +from .._vendor import _convert_request 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]] +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False +# fmt: off + +def build_list_runtime_versions_request( + **kwargs # type: Any +): + # type: (...) -> HttpRequest + api_version = "2020-07-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/providers/Microsoft.AppPlatform/runtimeVersions') + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + +# fmt: on class RuntimeVersionsOperations(object): """RuntimeVersionsOperations operations. @@ -44,6 +78,7 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def list_runtime_versions( self, **kwargs # type: Any @@ -61,21 +96,14 @@ def list_runtime_versions( 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 = build_list_runtime_versions_request( + template_url=self.list_runtime_versions.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -89,4 +117,6 @@ def list_runtime_versions( return cls(pipeline_response, deserialized, {}) return deserialized + list_runtime_versions.metadata = {'url': '/providers/Microsoft.AppPlatform/runtimeVersions'} # type: ignore + diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2020_07_01/operations/_services_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2020_07_01/operations/_services_operations.py index 6e2ae13f77437..c7a6c97d8d01c 100644 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2020_07_01/operations/_services_operations.py +++ b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2020_07_01/operations/_services_operations.py @@ -5,26 +5,438 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools from typing import TYPE_CHECKING import warnings 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.pipeline.transport import HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling +from msrest import Serializer from .. import models as _models +from .._vendor import _convert_request, _format_url_section 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]] +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False +# fmt: off + +def build_get_request( + subscription_id, # type: str + resource_group_name, # type: str + service_name, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + api_version = "2020-07-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_create_or_update_request_initial( + subscription_id, # type: str + resource_group_name, # type: str + service_name, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2020-07-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_delete_request_initial( + subscription_id, # type: str + resource_group_name, # type: str + service_name, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + api_version = "2020-07-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="DELETE", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_update_request_initial( + subscription_id, # type: str + resource_group_name, # type: str + service_name, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2020-07-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PATCH", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_list_test_keys_request( + subscription_id, # type: str + resource_group_name, # type: str + service_name, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + api_version = "2020-07-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/listTestKeys') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_regenerate_test_key_request( + subscription_id, # type: str + resource_group_name, # type: str + service_name, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2020-07-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/regenerateTestKey') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_disable_test_endpoint_request( + subscription_id, # type: str + resource_group_name, # type: str + service_name, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + api_version = "2020-07-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/disableTestEndpoint') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_enable_test_endpoint_request( + subscription_id, # type: str + resource_group_name, # type: str + service_name, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + api_version = "2020-07-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/enableTestEndpoint') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_check_name_availability_request( + subscription_id, # type: str + location, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2020-07-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.AppPlatform/locations/{location}/checkNameAvailability') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "location": _SERIALIZER.url("location", location, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_list_by_subscription_request( + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + api_version = "2020-07-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.AppPlatform/Spring') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_list_request( + subscription_id, # type: str + resource_group_name, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + api_version = "2020-07-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + +# fmt: on class ServicesOperations(object): """ServicesOperations operations. @@ -47,6 +459,7 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def get( self, resource_group_name, # type: str @@ -71,27 +484,17 @@ def get( 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 = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -105,8 +508,10 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}'} # type: ignore + def _create_or_update_initial( self, resource_group_name, # type: str @@ -120,32 +525,22 @@ def _create_or_update_initial( 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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = self._serialize.body(resource, 'ServiceResource') + + request = build_create_or_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -166,8 +561,11 @@ def _create_or_update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}'} # type: ignore + + @distributed_trace def begin_create_or_update( self, resource_group_name, # type: str @@ -187,15 +585,20 @@ def begin_create_or_update( :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. + :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: + :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 """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.ServiceResource"] lro_delay = kwargs.pop( 'polling_interval', @@ -207,27 +610,21 @@ def begin_create_or_update( resource_group_name=resource_group_name, service_name=service_name, resource=resource, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_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 = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -239,6 +636,7 @@ def get_long_running_output(pipeline_response): ) 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( @@ -253,27 +651,17 @@ def _delete_initial( 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 = build_delete_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -286,6 +674,8 @@ def _delete_initial( _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}'} # type: ignore + + @distributed_trace def begin_delete( self, resource_group_name, # type: str @@ -302,15 +692,17 @@ def begin_delete( :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 ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :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. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -324,21 +716,14 @@ def begin_delete( 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 = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -350,6 +735,7 @@ def get_long_running_output(pipeline_response): ) 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( @@ -365,32 +751,22 @@ def _update_initial( 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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = self._serialize.body(resource, 'ServiceResource') + + request = build_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + content_type=content_type, + json=_json, + template_url=self._update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -408,8 +784,11 @@ def _update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}'} # type: ignore + + @distributed_trace def begin_update( self, resource_group_name, # type: str @@ -429,15 +808,20 @@ def begin_update( :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. + :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: + :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 """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.ServiceResource"] lro_delay = kwargs.pop( 'polling_interval', @@ -449,27 +833,21 @@ def begin_update( resource_group_name=resource_group_name, service_name=service_name, resource=resource, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_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 = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -481,8 +859,10 @@ def get_long_running_output(pipeline_response): ) 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 + @distributed_trace def list_test_keys( self, resource_group_name, # type: str @@ -507,27 +887,17 @@ def list_test_keys( 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 = build_list_test_keys_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + template_url=self.list_test_keys.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -541,8 +911,11 @@ def list_test_keys( return cls(pipeline_response, deserialized, {}) return deserialized + list_test_keys.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/listTestKeys'} # type: ignore + + @distributed_trace def regenerate_test_key( self, resource_group_name, # type: str @@ -559,7 +932,8 @@ def regenerate_test_key( :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 + :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 @@ -570,32 +944,22 @@ def regenerate_test_key( 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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = self._serialize.body(regenerate_test_key_request, 'RegenerateTestKeyRequestPayload') + + request = build_regenerate_test_key_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + content_type=content_type, + json=_json, + template_url=self.regenerate_test_key.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -609,8 +973,11 @@ def regenerate_test_key( return cls(pipeline_response, deserialized, {}) return deserialized + regenerate_test_key.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/regenerateTestKey'} # type: ignore + + @distributed_trace def disable_test_endpoint( self, resource_group_name, # type: str @@ -635,27 +1002,17 @@ def disable_test_endpoint( 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 = build_disable_test_endpoint_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + template_url=self.disable_test_endpoint.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -668,6 +1025,8 @@ def disable_test_endpoint( disable_test_endpoint.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/disableTestEndpoint'} # type: ignore + + @distributed_trace def enable_test_endpoint( self, resource_group_name, # type: str @@ -692,27 +1051,17 @@ def enable_test_endpoint( 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 = build_enable_test_endpoint_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + template_url=self.enable_test_endpoint.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -726,8 +1075,11 @@ def enable_test_endpoint( return cls(pipeline_response, deserialized, {}) return deserialized + enable_test_endpoint.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/enableTestEndpoint'} # type: ignore + + @distributed_trace def check_name_availability( self, location, # type: str @@ -740,7 +1092,8 @@ def check_name_availability( :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 + :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 @@ -751,31 +1104,21 @@ def check_name_availability( 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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = self._serialize.body(availability_parameters, 'NameAvailabilityParameters') + + request = build_check_name_availability_request( + subscription_id=self._config.subscription_id, + location=location, + content_type=content_type, + json=_json, + template_url=self.check_name_availability.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -789,8 +1132,11 @@ def check_name_availability( return cls(pipeline_response, deserialized, {}) return deserialized + check_name_availability.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.AppPlatform/locations/{location}/checkNameAvailability'} # type: ignore + + @distributed_trace def list_by_subscription( self, **kwargs # type: Any @@ -800,7 +1146,8 @@ def list_by_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.paging.ItemPaged[~azure.mgmt.appplatform.v2020_07_01.models.ServiceResourceList] + :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"] @@ -808,34 +1155,29 @@ def list_by_subscription( 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) + + request = build_list_by_subscription_request( + subscription_id=self._config.subscription_id, + template_url=self.list_by_subscription.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_subscription_request( + subscription_id=self._config.subscription_id, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('ServiceResourceList', pipeline_response) + deserialized = self._deserialize("ServiceResourceList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -853,11 +1195,13 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) list_by_subscription.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.AppPlatform/Spring'} # type: ignore + @distributed_trace def list( self, resource_group_name, # type: str @@ -871,7 +1215,8 @@ def list( :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.paging.ItemPaged[~azure.mgmt.appplatform.v2020_07_01.models.ServiceResourceList] + :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"] @@ -879,35 +1224,31 @@ def list( 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) + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('ServiceResourceList', pipeline_response) + deserialized = self._deserialize("ServiceResourceList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -925,6 +1266,7 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2020_07_01/operations/_skus_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2020_07_01/operations/_skus_operations.py index 4e05d050f7018..b4b03a834b17a 100644 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2020_07_01/operations/_skus_operations.py +++ b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2020_07_01/operations/_skus_operations.py @@ -5,24 +5,64 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools from typing import TYPE_CHECKING import warnings 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.pipeline.transport import HttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat +from msrest import Serializer from .. import models as _models +from .._vendor import _convert_request, _format_url_section 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]] +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False +# fmt: off + +def build_list_request( + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + api_version = "2020-07-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.AppPlatform/skus') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + +# fmt: on class SkusOperations(object): """SkusOperations operations. @@ -45,6 +85,7 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def list( self, **kwargs # type: Any @@ -53,8 +94,10 @@ def list( """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.paging.ItemPaged[~azure.mgmt.appplatform.v2020_07_01.models.ResourceSkuCollection] + :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"] @@ -62,34 +105,29 @@ def list( 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) + + request = build_list_request( + subscription_id=self._config.subscription_id, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('ResourceSkuCollection', pipeline_response) + deserialized = self._deserialize("ResourceSkuCollection", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -107,6 +145,7 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2020_11_01_preview/__init__.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2020_11_01_preview/__init__.py index d2ddf950056ad..41ec6d71ff7fa 100644 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2020_11_01_preview/__init__.py +++ b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2020_11_01_preview/__init__.py @@ -12,8 +12,7 @@ __version__ = VERSION __all__ = ['AppPlatformManagementClient'] -try: - from ._patch import patch_sdk # type: ignore - patch_sdk() -except ImportError: - pass +# `._patch.py` is used for handwritten extensions to the generated code +# Example: https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md +from ._patch import patch_sdk +patch_sdk() diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2020_11_01_preview/_app_platform_management_client.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2020_11_01_preview/_app_platform_management_client.py index 3e902325d70e1..7638e871d229a 100644 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2020_11_01_preview/_app_platform_management_client.py +++ b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2020_11_01_preview/_app_platform_management_client.py @@ -6,32 +6,22 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from copy import deepcopy from typing import TYPE_CHECKING from azure.mgmt.core import ARMPipelineClient from msrest import Deserializer, Serializer +from . import models +from ._configuration import AppPlatformManagementClientConfiguration +from .operations import AppsOperations, BindingsOperations, CertificatesOperations, ConfigServersOperations, CustomDomainsOperations, DeploymentsOperations, MonitoringSettingsOperations, Operations, RuntimeVersionsOperations, ServicesOperations, SkusOperations + 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 -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 - + from azure.core.rest import HttpRequest, HttpResponse class AppPlatformManagementClient(object): """REST API for Azure Spring Cloud. @@ -39,91 +29,96 @@ class AppPlatformManagementClient(object): :ivar services: ServicesOperations operations :vartype services: azure.mgmt.appplatform.v2020_11_01_preview.operations.ServicesOperations :ivar config_servers: ConfigServersOperations operations - :vartype config_servers: azure.mgmt.appplatform.v2020_11_01_preview.operations.ConfigServersOperations + :vartype config_servers: + azure.mgmt.appplatform.v2020_11_01_preview.operations.ConfigServersOperations :ivar monitoring_settings: MonitoringSettingsOperations operations - :vartype monitoring_settings: azure.mgmt.appplatform.v2020_11_01_preview.operations.MonitoringSettingsOperations + :vartype monitoring_settings: + azure.mgmt.appplatform.v2020_11_01_preview.operations.MonitoringSettingsOperations :ivar apps: AppsOperations operations :vartype apps: azure.mgmt.appplatform.v2020_11_01_preview.operations.AppsOperations :ivar bindings: BindingsOperations operations :vartype bindings: azure.mgmt.appplatform.v2020_11_01_preview.operations.BindingsOperations :ivar certificates: CertificatesOperations operations - :vartype certificates: azure.mgmt.appplatform.v2020_11_01_preview.operations.CertificatesOperations + :vartype certificates: + azure.mgmt.appplatform.v2020_11_01_preview.operations.CertificatesOperations :ivar custom_domains: CustomDomainsOperations operations - :vartype custom_domains: azure.mgmt.appplatform.v2020_11_01_preview.operations.CustomDomainsOperations + :vartype custom_domains: + azure.mgmt.appplatform.v2020_11_01_preview.operations.CustomDomainsOperations :ivar deployments: DeploymentsOperations operations - :vartype deployments: azure.mgmt.appplatform.v2020_11_01_preview.operations.DeploymentsOperations + :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: RuntimeVersionsOperations operations - :vartype runtime_versions: azure.mgmt.appplatform.v2020_11_01_preview.operations.RuntimeVersionsOperations + :vartype runtime_versions: + azure.mgmt.appplatform.v2020_11_01_preview.operations.RuntimeVersionsOperations :ivar skus: SkusOperations operations :vartype skus: azure.mgmt.appplatform.v2020_11_01_preview.operations.SkusOperations :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. + :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. + :param base_url: Service URL. Default value is 'https://management.azure.com'. + :type base_url: str + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. """ def __init__( self, credential, # type: "TokenCredential" subscription_id, # type: str - base_url=None, # type: Optional[str] + base_url="https://management.azure.com", # type: str **kwargs # type: Any ): # type: (...) -> None - if not base_url: - base_url = 'https://management.azure.com' - self._config = AppPlatformManagementClientConfiguration(credential, subscription_id, **kwargs) + self._config = AppPlatformManagementClientConfiguration(credential=credential, subscription_id=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._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) - - def _send_request(self, http_request, **kwargs): - # type: (HttpRequest, Any) -> HttpResponse + self._serialize.client_side_validation = False + 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) + + + def _send_request( + self, + request, # type: HttpRequest + **kwargs # type: Any + ): + # type: (...) -> 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. + >>> from azure.core.rest import HttpRequest + >>> request = HttpRequest("GET", "https://www.example.org/") + + >>> response = client._send_request(request) + + + For more information on this code flow, see https://aka.ms/azsdk/python/protocol/quickstart + + :param request: The network request you want to make. Required. + :type request: ~azure.core.rest.HttpRequest + :keyword bool stream: Whether the response payload will be streamed. Defaults to False. :return: The response of your network call. Does not do error handling on your response. - :rtype: ~azure.core.pipeline.transport.HttpResponse + :rtype: ~azure.core.rest.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 + + request_copy = deepcopy(request) + request_copy.url = self._client.format_url(request_copy.url) + return self._client.send_request(request_copy, **kwargs) def close(self): # type: () -> None diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2020_11_01_preview/_configuration.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2020_11_01_preview/_configuration.py index 9678a78ee7725..e5d25a268150b 100644 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2020_11_01_preview/_configuration.py +++ b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2020_11_01_preview/_configuration.py @@ -10,7 +10,7 @@ from azure.core.configuration import Configuration from azure.core.pipeline import policies -from azure.mgmt.core.policies import ARMHttpLoggingPolicy +from azure.mgmt.core.policies import ARMChallengeAuthenticationPolicy, ARMHttpLoggingPolicy from ._version import VERSION @@ -40,11 +40,11 @@ def __init__( **kwargs # type: Any ): # type: (...) -> None + super(AppPlatformManagementClientConfiguration, self).__init__(**kwargs) 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 @@ -68,4 +68,4 @@ def _configure( 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) + self.authentication_policy = ARMChallengeAuthenticationPolicy(self.credential, *self.credential_scopes, **kwargs) diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2020_11_01_preview/_metadata.json b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2020_11_01_preview/_metadata.json index 22c085a41a381..c64af47d0dc33 100644 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2020_11_01_preview/_metadata.json +++ b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2020_11_01_preview/_metadata.json @@ -5,13 +5,13 @@ "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, + "host_value": "\"https://management.azure.com\"", + "parameterized_host_template": 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\"]}}}" + "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\"]}}}", + "async_imports": "{\"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"], \"azure.core.credentials\": [\"TokenCredential\"]}}, \"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\"]}}}" }, "global_parameters": { "sync": { @@ -54,7 +54,7 @@ "required": false }, "base_url": { - "signature": "base_url=None, # type: Optional[str]", + "signature": "base_url=\"https://management.azure.com\", # type: str", "description": "Service URL", "docstring_type": "str", "required": false @@ -74,7 +74,7 @@ "required": false }, "base_url": { - "signature": "base_url: Optional[str] = None,", + "signature": "base_url: str = \"https://management.azure.com\",", "description": "Service URL", "docstring_type": "str", "required": false @@ -91,11 +91,10 @@ "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\"]}}}" + "credential_call_sync": "ARMChallengeAuthenticationPolicy(self.credential, *self.credential_scopes, **kwargs)", + "credential_call_async": "AsyncARMChallengeAuthenticationPolicy(self.credential, *self.credential_scopes, **kwargs)", + "sync_imports": "{\"regular\": {\"azurecore\": {\"azure.core.configuration\": [\"Configuration\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMChallengeAuthenticationPolicy\", \"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\", \"AsyncARMChallengeAuthenticationPolicy\"]}, \"local\": {\".._version\": [\"VERSION\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\"]}}, \"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}}" }, "operation_groups": { "services": "ServicesOperations", diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2020_11_01_preview/_patch.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2020_11_01_preview/_patch.py new file mode 100644 index 0000000000000..74e48ecd07cf3 --- /dev/null +++ b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2020_11_01_preview/_patch.py @@ -0,0 +1,31 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# +# Copyright (c) Microsoft Corporation. All rights reserved. +# +# The MIT License (MIT) +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the ""Software""), to +# deal in the Software without restriction, including without limitation the +# rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +# sell copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in +# all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED *AS IS*, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +# IN THE SOFTWARE. +# +# -------------------------------------------------------------------------- + +# This file is used for handwritten extensions to the generated code. Example: +# https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md +def patch_sdk(): + pass \ No newline at end of file diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2020_11_01_preview/_vendor.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2020_11_01_preview/_vendor.py new file mode 100644 index 0000000000000..138f663c53a4e --- /dev/null +++ b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2020_11_01_preview/_vendor.py @@ -0,0 +1,27 @@ +# -------------------------------------------------------------------------- +# 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 azure.core.pipeline.transport import HttpRequest + +def _convert_request(request, files=None): + data = request.content if not files else None + request = HttpRequest(method=request.method, url=request.url, headers=request.headers, data=data) + if files: + request.set_formdata_body(files) + return request + +def _format_url_section(template, **kwargs): + components = template.split("/") + while components: + try: + return template.format(**kwargs) + except KeyError as key: + formatted_components = template.split("/") + components = [ + c for c in formatted_components if "{}".format(key.args[0]) not in c + ] + template = "/".join(components) diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2020_11_01_preview/_version.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2020_11_01_preview/_version.py index 92453d8691d96..e5754a47ce68f 100644 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2020_11_01_preview/_version.py +++ b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2020_11_01_preview/_version.py @@ -6,4 +6,4 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "6.1.0" +VERSION = "1.0.0b1" diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2020_11_01_preview/aio/__init__.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2020_11_01_preview/aio/__init__.py index 39f1054887358..44ce4a5043f80 100644 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2020_11_01_preview/aio/__init__.py +++ b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2020_11_01_preview/aio/__init__.py @@ -8,3 +8,8 @@ from ._app_platform_management_client import AppPlatformManagementClient __all__ = ['AppPlatformManagementClient'] + +# `._patch.py` is used for handwritten extensions to the generated code +# Example: https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md +from ._patch import patch_sdk +patch_sdk() diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2020_11_01_preview/aio/_app_platform_management_client.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2020_11_01_preview/aio/_app_platform_management_client.py index 5ca00dfff68a6..d8df9d3ba84d6 100644 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2020_11_01_preview/aio/_app_platform_management_client.py +++ b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2020_11_01_preview/aio/_app_platform_management_client.py @@ -6,120 +6,115 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, Optional, TYPE_CHECKING +from copy import deepcopy +from typing import Any, Awaitable, Optional, TYPE_CHECKING -from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.mgmt.core import AsyncARMPipelineClient from msrest import Deserializer, Serializer +from .. import models +from ._configuration import AppPlatformManagementClientConfiguration +from .operations import AppsOperations, BindingsOperations, CertificatesOperations, ConfigServersOperations, CustomDomainsOperations, DeploymentsOperations, MonitoringSettingsOperations, Operations, RuntimeVersionsOperations, ServicesOperations, SkusOperations + 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): +class AppPlatformManagementClient: """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 + :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 + :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 + :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 + :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 + :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 + :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. + :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. + :param base_url: Service URL. Default value is 'https://management.azure.com'. + :type base_url: str + :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, + base_url: str = "https://management.azure.com", **kwargs: Any ) -> None: - if not base_url: - base_url = 'https://management.azure.com' - self._config = AppPlatformManagementClientConfiguration(credential, subscription_id, **kwargs) + self._config = AppPlatformManagementClientConfiguration(credential=credential, subscription_id=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._serialize.client_side_validation = False + 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) + - 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: + def _send_request( + self, + request: HttpRequest, + **kwargs: Any + ) -> Awaitable[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. + >>> from azure.core.rest import HttpRequest + >>> request = HttpRequest("GET", "https://www.example.org/") + + >>> response = await client._send_request(request) + + + For more information on this code flow, see https://aka.ms/azsdk/python/protocol/quickstart + + :param request: The network request you want to make. Required. + :type request: ~azure.core.rest.HttpRequest + :keyword bool stream: Whether the response payload will be streamed. Defaults to False. :return: The response of your network call. Does not do error handling on your response. - :rtype: ~azure.core.pipeline.transport.AsyncHttpResponse + :rtype: ~azure.core.rest.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 + + request_copy = deepcopy(request) + request_copy.url = self._client.format_url(request_copy.url) + return self._client.send_request(request_copy, **kwargs) async def close(self) -> None: await self._client.close() diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2020_11_01_preview/aio/_configuration.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2020_11_01_preview/aio/_configuration.py index 89cd6bbbc8e57..adb5d8c408225 100644 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2020_11_01_preview/aio/_configuration.py +++ b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2020_11_01_preview/aio/_configuration.py @@ -10,7 +10,7 @@ from azure.core.configuration import Configuration from azure.core.pipeline import policies -from azure.mgmt.core.policies import ARMHttpLoggingPolicy +from azure.mgmt.core.policies import ARMHttpLoggingPolicy, AsyncARMChallengeAuthenticationPolicy from .._version import VERSION @@ -37,11 +37,11 @@ def __init__( subscription_id: str, **kwargs: Any ) -> None: + super(AppPlatformManagementClientConfiguration, self).__init__(**kwargs) 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 @@ -64,4 +64,4 @@ def _configure( 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) + self.authentication_policy = AsyncARMChallengeAuthenticationPolicy(self.credential, *self.credential_scopes, **kwargs) diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2020_11_01_preview/aio/_patch.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2020_11_01_preview/aio/_patch.py new file mode 100644 index 0000000000000..74e48ecd07cf3 --- /dev/null +++ b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2020_11_01_preview/aio/_patch.py @@ -0,0 +1,31 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# +# Copyright (c) Microsoft Corporation. All rights reserved. +# +# The MIT License (MIT) +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the ""Software""), to +# deal in the Software without restriction, including without limitation the +# rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +# sell copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in +# all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED *AS IS*, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +# IN THE SOFTWARE. +# +# -------------------------------------------------------------------------- + +# This file is used for handwritten extensions to the generated code. Example: +# https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md +def patch_sdk(): + pass \ No newline at end of file diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2020_11_01_preview/aio/operations/_apps_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2020_11_01_preview/aio/operations/_apps_operations.py index 19ae52718842f..1548d7fa9c994 100644 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2020_11_01_preview/aio/operations/_apps_operations.py +++ b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2020_11_01_preview/aio/operations/_apps_operations.py @@ -5,19 +5,24 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools 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.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._apps_operations import build_create_or_update_request_initial, build_delete_request_initial, build_get_request, build_get_resource_upload_url_request, build_list_request, build_update_request_initial, build_validate_domain_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -43,6 +48,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace_async async def get( self, resource_group_name: str, @@ -72,30 +78,19 @@ async def get( 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 = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + sync_status=sync_status, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -109,8 +104,10 @@ async def get( 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, @@ -124,33 +121,23 @@ async def _create_or_update_initial( 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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = self._serialize.body(app_resource, 'AppResource') + + request = build_create_or_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -171,8 +158,11 @@ async def _create_or_update_initial( 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 + + @distributed_trace_async async def begin_create_or_update( self, resource_group_name: str, @@ -194,15 +184,20 @@ async def begin_create_or_update( :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. + :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: + :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] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.AppResource"] lro_delay = kwargs.pop( 'polling_interval', @@ -215,28 +210,21 @@ async def begin_create_or_update( service_name=service_name, app_name=app_name, app_resource=app_resource, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_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) + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -248,6 +236,7 @@ def get_long_running_output(pipeline_response): ) 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( @@ -262,28 +251,18 @@ async def _delete_initial( 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 = build_delete_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -296,6 +275,8 @@ async def _delete_initial( _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}'} # type: ignore + + @distributed_trace_async async def begin_delete( self, resource_group_name: str, @@ -314,15 +295,17 @@ async def begin_delete( :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. + :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. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -337,22 +320,14 @@ async def begin_delete( 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) + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -364,6 +339,7 @@ def get_long_running_output(pipeline_response): ) 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( @@ -379,33 +355,23 @@ async def _update_initial( 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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(app_resource, 'AppResource') - # 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') + request = build_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + content_type=content_type, + json=_json, + template_url=self._update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -423,8 +389,11 @@ async def _update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}'} # type: ignore + + @distributed_trace_async async def begin_update( self, resource_group_name: str, @@ -446,15 +415,20 @@ async def begin_update( :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. + :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: + :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] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.AppResource"] lro_delay = kwargs.pop( 'polling_interval', @@ -467,28 +441,21 @@ async def begin_update( service_name=service_name, app_name=app_name, app_resource=app_resource, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_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) + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -500,8 +467,10 @@ def get_long_running_output(pipeline_response): ) 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 + @distributed_trace def list( self, resource_group_name: str, @@ -516,8 +485,10 @@ def list( :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] + :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"] @@ -525,36 +496,33 @@ def list( 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) + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('AppResourceCollection', pipeline_response) + deserialized = self._deserialize("AppResourceCollection", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -572,11 +540,13 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps'} # type: ignore + @distributed_trace_async async def get_resource_upload_url( self, resource_group_name: str, @@ -603,28 +573,18 @@ async def get_resource_upload_url( 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 = build_get_resource_upload_url_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + template_url=self.get_resource_upload_url.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -638,8 +598,11 @@ async def get_resource_upload_url( 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 + + @distributed_trace_async async def validate_domain( self, resource_group_name: str, @@ -658,7 +621,8 @@ async def validate_domain( :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 + :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 @@ -669,33 +633,23 @@ async def validate_domain( 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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(validate_payload, 'CustomDomainValidatePayload') - # 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') + request = build_validate_domain_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + content_type=content_type, + json=_json, + template_url=self.validate_domain.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -709,4 +663,6 @@ async def validate_domain( 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/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2020_11_01_preview/aio/operations/_bindings_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2020_11_01_preview/aio/operations/_bindings_operations.py index 77f8b3f7fe8ca..5f1c51e64081e 100644 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2020_11_01_preview/aio/operations/_bindings_operations.py +++ b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2020_11_01_preview/aio/operations/_bindings_operations.py @@ -5,19 +5,24 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools 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.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._bindings_operations import build_create_or_update_request_initial, build_delete_request_initial, build_get_request, build_list_request, build_update_request_initial T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -43,6 +48,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace_async async def get( self, resource_group_name: str, @@ -72,29 +78,19 @@ async def get( 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 = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + binding_name=binding_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -108,8 +104,10 @@ async def get( 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, @@ -124,34 +122,24 @@ async def _create_or_update_initial( 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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = self._serialize.body(binding_resource, 'BindingResource') + + request = build_create_or_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + binding_name=binding_name, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -172,8 +160,11 @@ async def _create_or_update_initial( 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 + + @distributed_trace_async async def begin_create_or_update( self, resource_group_name: str, @@ -198,15 +189,20 @@ async def begin_create_or_update( :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. + :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: + :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] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.BindingResource"] lro_delay = kwargs.pop( 'polling_interval', @@ -220,29 +216,21 @@ async def begin_create_or_update( app_name=app_name, binding_name=binding_name, binding_resource=binding_resource, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_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) + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -254,6 +242,7 @@ def get_long_running_output(pipeline_response): ) 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( @@ -269,29 +258,19 @@ async def _delete_initial( 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 = build_delete_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + binding_name=binding_name, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -304,6 +283,8 @@ async def _delete_initial( _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/bindings/{bindingName}'} # type: ignore + + @distributed_trace_async async def begin_delete( self, resource_group_name: str, @@ -325,15 +306,17 @@ async def begin_delete( :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. + :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. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -349,23 +332,14 @@ async def begin_delete( 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) + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -377,6 +351,7 @@ def get_long_running_output(pipeline_response): ) 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( @@ -393,34 +368,24 @@ async def _update_initial( 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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(binding_resource, 'BindingResource') - # 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') + request = build_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + binding_name=binding_name, + content_type=content_type, + json=_json, + template_url=self._update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -438,8 +403,11 @@ async def _update_initial( 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 + + @distributed_trace_async async def begin_update( self, resource_group_name: str, @@ -464,15 +432,20 @@ async def begin_update( :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. + :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: + :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] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.BindingResource"] lro_delay = kwargs.pop( 'polling_interval', @@ -486,29 +459,21 @@ async def begin_update( app_name=app_name, binding_name=binding_name, binding_resource=binding_resource, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_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) + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -520,8 +485,10 @@ def get_long_running_output(pipeline_response): ) 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 + @distributed_trace def list( self, resource_group_name: str, @@ -539,8 +506,10 @@ def list( :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] + :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"] @@ -548,37 +517,35 @@ def list( 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) + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('BindingResourceCollection', pipeline_response) + deserialized = self._deserialize("BindingResourceCollection", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -596,6 +563,7 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2020_11_01_preview/aio/operations/_certificates_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2020_11_01_preview/aio/operations/_certificates_operations.py index 71b2ff176befb..6565bf8945af0 100644 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2020_11_01_preview/aio/operations/_certificates_operations.py +++ b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2020_11_01_preview/aio/operations/_certificates_operations.py @@ -5,19 +5,24 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools 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.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._certificates_operations import build_create_or_update_request_initial, build_delete_request_initial, build_get_request, build_list_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -43,6 +48,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace_async async def get( self, resource_group_name: str, @@ -69,28 +75,18 @@ async def get( 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 = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + certificate_name=certificate_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -104,8 +100,10 @@ async def get( 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, @@ -119,33 +117,23 @@ async def _create_or_update_initial( 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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = self._serialize.body(certificate_resource, 'CertificateResource') + + request = build_create_or_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + certificate_name=certificate_name, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -166,8 +154,11 @@ async def _create_or_update_initial( 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 + + @distributed_trace_async async def begin_create_or_update( self, resource_group_name: str, @@ -186,18 +177,24 @@ async def begin_create_or_update( :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 + :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. + :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: + :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] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.CertificateResource"] lro_delay = kwargs.pop( 'polling_interval', @@ -210,28 +207,21 @@ async def begin_create_or_update( service_name=service_name, certificate_name=certificate_name, certificate_resource=certificate_resource, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_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) + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -243,6 +233,7 @@ def get_long_running_output(pipeline_response): ) 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( @@ -257,28 +248,18 @@ async def _delete_initial( 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 = build_delete_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + certificate_name=certificate_name, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -291,6 +272,8 @@ async def _delete_initial( _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/certificates/{certificateName}'} # type: ignore + + @distributed_trace_async async def begin_delete( self, resource_group_name: str, @@ -309,15 +292,17 @@ async def begin_delete( :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. + :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. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -332,22 +317,14 @@ async def begin_delete( 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) + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -359,8 +336,10 @@ def get_long_running_output(pipeline_response): ) 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 + @distributed_trace def list( self, resource_group_name: str, @@ -375,8 +354,10 @@ def list( :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] + :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"] @@ -384,36 +365,33 @@ def list( 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) + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('CertificateResourceCollection', pipeline_response) + deserialized = self._deserialize("CertificateResourceCollection", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -431,6 +409,7 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2020_11_01_preview/aio/operations/_config_servers_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2020_11_01_preview/aio/operations/_config_servers_operations.py index 175fc48484df0..72f48be54800a 100644 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2020_11_01_preview/aio/operations/_config_servers_operations.py +++ b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2020_11_01_preview/aio/operations/_config_servers_operations.py @@ -5,18 +5,22 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools 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.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._config_servers_operations import build_get_request, build_update_patch_request_initial, build_update_put_request_initial, build_validate_request_initial T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -42,6 +46,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace_async async def get( self, resource_group_name: str, @@ -65,27 +70,17 @@ async def get( 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 = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -99,8 +94,10 @@ async def get( 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, @@ -113,32 +110,22 @@ async def _update_put_initial( 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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = self._serialize.body(config_server_resource, 'ConfigServerResource') + + request = build_update_put_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + content_type=content_type, + json=_json, + template_url=self._update_put_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -156,8 +143,11 @@ async def _update_put_initial( 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 + + @distributed_trace_async async def begin_update_put( self, resource_group_name: str, @@ -173,18 +163,24 @@ async def begin_update_put( :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 + :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. + :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: + :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] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.ConfigServerResource"] lro_delay = kwargs.pop( 'polling_interval', @@ -196,27 +192,21 @@ async def begin_update_put( resource_group_name=resource_group_name, service_name=service_name, config_server_resource=config_server_resource, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_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) + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -228,6 +218,7 @@ def get_long_running_output(pipeline_response): ) 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( @@ -242,32 +233,22 @@ async def _update_patch_initial( 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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(config_server_resource, 'ConfigServerResource') - # 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') + request = build_update_patch_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + content_type=content_type, + json=_json, + template_url=self._update_patch_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -285,8 +266,11 @@ async def _update_patch_initial( 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 + + @distributed_trace_async async def begin_update_patch( self, resource_group_name: str, @@ -302,18 +286,24 @@ async def begin_update_patch( :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 + :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. + :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: + :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] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.ConfigServerResource"] lro_delay = kwargs.pop( 'polling_interval', @@ -325,27 +315,21 @@ async def begin_update_patch( resource_group_name=resource_group_name, service_name=service_name, config_server_resource=config_server_resource, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_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) + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -357,6 +341,7 @@ def get_long_running_output(pipeline_response): ) 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( @@ -371,32 +356,22 @@ async def _validate_initial( 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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = self._serialize.body(config_server_settings, 'ConfigServerSettings') + + request = build_validate_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + content_type=content_type, + json=_json, + template_url=self._validate_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -414,8 +389,11 @@ async def _validate_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _validate_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configServers/validate'} # type: ignore + + @distributed_trace_async async def begin_validate( self, resource_group_name: str, @@ -431,18 +409,24 @@ async def begin_validate( :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 + :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. + :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: + :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] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.ConfigServerSettingsValidateResult"] lro_delay = kwargs.pop( 'polling_interval', @@ -454,27 +438,21 @@ async def begin_validate( resource_group_name=resource_group_name, service_name=service_name, config_server_settings=config_server_settings, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_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) + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -486,4 +464,5 @@ def get_long_running_output(pipeline_response): ) 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/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2020_11_01_preview/aio/operations/_custom_domains_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2020_11_01_preview/aio/operations/_custom_domains_operations.py index 40546c17e4ff3..37101055e3776 100644 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2020_11_01_preview/aio/operations/_custom_domains_operations.py +++ b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2020_11_01_preview/aio/operations/_custom_domains_operations.py @@ -5,19 +5,24 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools 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.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._custom_domains_operations import build_create_or_update_request_initial, build_delete_request_initial, build_get_request, build_list_request, build_update_request_initial T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -43,6 +48,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace_async async def get( self, resource_group_name: str, @@ -72,29 +78,19 @@ async def get( 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 = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + domain_name=domain_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -108,8 +104,10 @@ async def get( 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, @@ -124,34 +122,24 @@ async def _create_or_update_initial( 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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = self._serialize.body(domain_resource, 'CustomDomainResource') + + request = build_create_or_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + domain_name=domain_name, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -172,8 +160,11 @@ async def _create_or_update_initial( 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 + + @distributed_trace_async async def begin_create_or_update( self, resource_group_name: str, @@ -198,15 +189,20 @@ async def begin_create_or_update( :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. + :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: + :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] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.CustomDomainResource"] lro_delay = kwargs.pop( 'polling_interval', @@ -220,29 +216,21 @@ async def begin_create_or_update( app_name=app_name, domain_name=domain_name, domain_resource=domain_resource, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_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) + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -254,6 +242,7 @@ def get_long_running_output(pipeline_response): ) 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( @@ -269,29 +258,19 @@ async def _delete_initial( 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 = build_delete_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + domain_name=domain_name, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -304,6 +283,8 @@ async def _delete_initial( _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/domains/{domainName}'} # type: ignore + + @distributed_trace_async async def begin_delete( self, resource_group_name: str, @@ -325,15 +306,17 @@ async def begin_delete( :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. + :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. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -349,23 +332,14 @@ async def begin_delete( 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) + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -377,6 +351,7 @@ def get_long_running_output(pipeline_response): ) 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( @@ -393,34 +368,24 @@ async def _update_initial( 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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(domain_resource, 'CustomDomainResource') - # 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') + request = build_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + domain_name=domain_name, + content_type=content_type, + json=_json, + template_url=self._update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -438,8 +403,11 @@ async def _update_initial( 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 + + @distributed_trace_async async def begin_update( self, resource_group_name: str, @@ -464,15 +432,20 @@ async def begin_update( :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. + :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: + :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] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.CustomDomainResource"] lro_delay = kwargs.pop( 'polling_interval', @@ -486,29 +459,21 @@ async def begin_update( app_name=app_name, domain_name=domain_name, domain_resource=domain_resource, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_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) + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -520,8 +485,10 @@ def get_long_running_output(pipeline_response): ) 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 + @distributed_trace def list( self, resource_group_name: str, @@ -539,8 +506,10 @@ def list( :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] + :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"] @@ -548,37 +517,35 @@ def list( 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) + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('CustomDomainResourceCollection', pipeline_response) + deserialized = self._deserialize("CustomDomainResourceCollection", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -596,6 +563,7 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2020_11_01_preview/aio/operations/_deployments_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2020_11_01_preview/aio/operations/_deployments_operations.py index 1428ce78df969..8923d93f8f0fb 100644 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2020_11_01_preview/aio/operations/_deployments_operations.py +++ b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2020_11_01_preview/aio/operations/_deployments_operations.py @@ -5,19 +5,24 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools 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.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._deployments_operations import build_create_or_update_request_initial, build_delete_request_initial, build_get_log_file_url_request, build_get_request, build_list_for_cluster_request, build_list_request, build_restart_request_initial, build_start_request_initial, build_stop_request_initial, build_update_request_initial T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -43,6 +48,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace_async async def get( self, resource_group_name: str, @@ -72,29 +78,19 @@ async def get( 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 = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + deployment_name=deployment_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -108,8 +104,10 @@ async def get( 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, @@ -124,34 +122,24 @@ async def _create_or_update_initial( 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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = self._serialize.body(deployment_resource, 'DeploymentResource') + + request = build_create_or_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + deployment_name=deployment_name, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -172,8 +160,11 @@ async def _create_or_update_initial( 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 + + @distributed_trace_async async def begin_create_or_update( self, resource_group_name: str, @@ -195,18 +186,24 @@ async def begin_create_or_update( :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 + :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. + :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: + :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] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.DeploymentResource"] lro_delay = kwargs.pop( 'polling_interval', @@ -220,29 +217,21 @@ async def begin_create_or_update( app_name=app_name, deployment_name=deployment_name, deployment_resource=deployment_resource, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_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) + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -254,6 +243,7 @@ def get_long_running_output(pipeline_response): ) 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( @@ -269,29 +259,19 @@ async def _delete_initial( 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 = build_delete_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + deployment_name=deployment_name, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -304,6 +284,8 @@ async def _delete_initial( _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}'} # type: ignore + + @distributed_trace_async async def begin_delete( self, resource_group_name: str, @@ -325,15 +307,17 @@ async def begin_delete( :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. + :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. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -349,23 +333,14 @@ async def begin_delete( 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) + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -377,6 +352,7 @@ def get_long_running_output(pipeline_response): ) 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( @@ -393,34 +369,24 @@ async def _update_initial( 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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = self._serialize.body(deployment_resource, 'DeploymentResource') + + request = build_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + deployment_name=deployment_name, + content_type=content_type, + json=_json, + template_url=self._update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -438,8 +404,11 @@ async def _update_initial( 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 + + @distributed_trace_async async def begin_update( self, resource_group_name: str, @@ -461,18 +430,24 @@ async def begin_update( :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 + :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. + :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: + :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] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.DeploymentResource"] lro_delay = kwargs.pop( 'polling_interval', @@ -486,29 +461,21 @@ async def begin_update( app_name=app_name, deployment_name=deployment_name, deployment_resource=deployment_resource, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_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) + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -520,8 +487,10 @@ def get_long_running_output(pipeline_response): ) 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 + @distributed_trace def list( self, resource_group_name: str, @@ -542,8 +511,10 @@ def list( :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] + :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"] @@ -551,39 +522,37 @@ def list( 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) + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + version=version, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + version=version, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('DeploymentResourceCollection', pipeline_response) + deserialized = self._deserialize("DeploymentResourceCollection", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -601,11 +570,13 @@ async def get_next(next_link=None): 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 + @distributed_trace def list_for_cluster( self, resource_group_name: str, @@ -623,8 +594,10 @@ def list_for_cluster( :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] + :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"] @@ -632,38 +605,35 @@ def list_for_cluster( 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) + + request = build_list_for_cluster_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + version=version, + template_url=self.list_for_cluster.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_for_cluster_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + version=version, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('DeploymentResourceCollection', pipeline_response) + deserialized = self._deserialize("DeploymentResourceCollection", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -681,6 +651,7 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) @@ -699,29 +670,19 @@ async def _start_initial( 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 = build_start_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + deployment_name=deployment_name, + template_url=self._start_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -734,6 +695,8 @@ async def _start_initial( _start_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/start'} # type: ignore + + @distributed_trace_async async def begin_start( self, resource_group_name: str, @@ -755,15 +718,17 @@ async def begin_start( :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. + :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. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -779,23 +744,14 @@ async def begin_start( 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) + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -807,6 +763,7 @@ def get_long_running_output(pipeline_response): ) 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( @@ -822,29 +779,19 @@ async def _stop_initial( 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 = build_stop_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + deployment_name=deployment_name, + template_url=self._stop_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -857,6 +804,8 @@ async def _stop_initial( _stop_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/stop'} # type: ignore + + @distributed_trace_async async def begin_stop( self, resource_group_name: str, @@ -878,15 +827,17 @@ async def begin_stop( :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. + :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. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -902,23 +853,14 @@ async def begin_stop( 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) + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -930,6 +872,7 @@ def get_long_running_output(pipeline_response): ) 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( @@ -945,29 +888,19 @@ async def _restart_initial( 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 = build_restart_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + deployment_name=deployment_name, + template_url=self._restart_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -980,6 +913,8 @@ async def _restart_initial( _restart_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/restart'} # type: ignore + + @distributed_trace_async async def begin_restart( self, resource_group_name: str, @@ -1001,15 +936,17 @@ async def begin_restart( :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. + :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. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -1025,23 +962,14 @@ async def begin_restart( 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) + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -1053,8 +981,10 @@ def get_long_running_output(pipeline_response): ) 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 + @distributed_trace_async async def get_log_file_url( self, resource_group_name: str, @@ -1084,29 +1014,19 @@ async def get_log_file_url( 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 = build_get_log_file_url_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + deployment_name=deployment_name, + template_url=self.get_log_file_url.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -1122,4 +1042,6 @@ async def get_log_file_url( 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/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2020_11_01_preview/aio/operations/_monitoring_settings_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2020_11_01_preview/aio/operations/_monitoring_settings_operations.py index 6ee477698c7ab..13533b4fd398c 100644 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2020_11_01_preview/aio/operations/_monitoring_settings_operations.py +++ b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2020_11_01_preview/aio/operations/_monitoring_settings_operations.py @@ -5,18 +5,22 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools 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.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._monitoring_settings_operations import build_get_request, build_update_patch_request_initial, build_update_put_request_initial T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -42,6 +46,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace_async async def get( self, resource_group_name: str, @@ -65,27 +70,17 @@ async def get( 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 = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -99,8 +94,10 @@ async def get( 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, @@ -113,32 +110,22 @@ async def _update_put_initial( 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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = self._serialize.body(monitoring_setting_resource, 'MonitoringSettingResource') + + request = build_update_put_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + content_type=content_type, + json=_json, + template_url=self._update_put_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -156,8 +143,11 @@ async def _update_put_initial( 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 + + @distributed_trace_async async def begin_update_put( self, resource_group_name: str, @@ -173,18 +163,24 @@ async def begin_update_put( :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 + :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. + :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: + :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] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.MonitoringSettingResource"] lro_delay = kwargs.pop( 'polling_interval', @@ -196,27 +192,21 @@ async def begin_update_put( resource_group_name=resource_group_name, service_name=service_name, monitoring_setting_resource=monitoring_setting_resource, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_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) + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -228,6 +218,7 @@ def get_long_running_output(pipeline_response): ) 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( @@ -242,32 +233,22 @@ async def _update_patch_initial( 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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = self._serialize.body(monitoring_setting_resource, 'MonitoringSettingResource') + + request = build_update_patch_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + content_type=content_type, + json=_json, + template_url=self._update_patch_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -285,8 +266,11 @@ async def _update_patch_initial( 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 + + @distributed_trace_async async def begin_update_patch( self, resource_group_name: str, @@ -302,18 +286,24 @@ async def begin_update_patch( :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 + :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. + :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: + :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] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.MonitoringSettingResource"] lro_delay = kwargs.pop( 'polling_interval', @@ -325,27 +315,21 @@ async def begin_update_patch( resource_group_name=resource_group_name, service_name=service_name, monitoring_setting_resource=monitoring_setting_resource, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_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) + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -357,4 +341,5 @@ def get_long_running_output(pipeline_response): ) 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/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2020_11_01_preview/aio/operations/_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2020_11_01_preview/aio/operations/_operations.py index 4353874d4481f..295fdb94f41ae 100644 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2020_11_01_preview/aio/operations/_operations.py +++ b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2020_11_01_preview/aio/operations/_operations.py @@ -5,17 +5,22 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools 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.core.pipeline.transport import AsyncHttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._operations import build_list_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -41,6 +46,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace def list( self, **kwargs: Any @@ -49,7 +55,8 @@ def list( :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] + :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"] @@ -57,30 +64,27 @@ def list( 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 = build_list_request( + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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) + + request = build_list_request( + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('AvailableOperations', pipeline_response) + deserialized = self._deserialize("AvailableOperations", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -98,6 +102,7 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2020_11_01_preview/aio/operations/_runtime_versions_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2020_11_01_preview/aio/operations/_runtime_versions_operations.py index a4d5694011305..e190b2649562b 100644 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2020_11_01_preview/aio/operations/_runtime_versions_operations.py +++ b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2020_11_01_preview/aio/operations/_runtime_versions_operations.py @@ -5,16 +5,20 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools 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.core.pipeline.transport import AsyncHttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._runtime_versions_operations import build_list_runtime_versions_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -40,6 +44,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace_async async def list_runtime_versions( self, **kwargs: Any @@ -56,21 +61,14 @@ async def list_runtime_versions( 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 = build_list_runtime_versions_request( + template_url=self.list_runtime_versions.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -84,4 +82,6 @@ async def list_runtime_versions( return cls(pipeline_response, deserialized, {}) return deserialized + list_runtime_versions.metadata = {'url': '/providers/Microsoft.AppPlatform/runtimeVersions'} # type: ignore + diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2020_11_01_preview/aio/operations/_services_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2020_11_01_preview/aio/operations/_services_operations.py index b525473b065d5..97b8dfd37245e 100644 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2020_11_01_preview/aio/operations/_services_operations.py +++ b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2020_11_01_preview/aio/operations/_services_operations.py @@ -5,19 +5,24 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools 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.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._services_operations import build_check_name_availability_request, build_create_or_update_request_initial, build_delete_request_initial, build_disable_test_endpoint_request, build_enable_test_endpoint_request, build_get_request, build_list_by_subscription_request, build_list_request, build_list_test_keys_request, build_regenerate_test_key_request, build_update_request_initial T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -43,6 +48,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace_async async def get( self, resource_group_name: str, @@ -66,27 +72,17 @@ async def get( 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 = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -100,8 +96,10 @@ async def get( 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, @@ -114,32 +112,22 @@ async def _create_or_update_initial( 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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = self._serialize.body(resource, 'ServiceResource') + + request = build_create_or_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -160,8 +148,11 @@ async def _create_or_update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}'} # type: ignore + + @distributed_trace_async async def begin_create_or_update( self, resource_group_name: str, @@ -180,15 +171,20 @@ async def begin_create_or_update( :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. + :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: + :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] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.ServiceResource"] lro_delay = kwargs.pop( 'polling_interval', @@ -200,27 +196,21 @@ async def begin_create_or_update( resource_group_name=resource_group_name, service_name=service_name, resource=resource, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_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) + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -232,6 +222,7 @@ def get_long_running_output(pipeline_response): ) 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( @@ -245,27 +236,17 @@ async def _delete_initial( 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 = build_delete_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -278,6 +259,8 @@ async def _delete_initial( _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}'} # type: ignore + + @distributed_trace_async async def begin_delete( self, resource_group_name: str, @@ -293,15 +276,17 @@ async def begin_delete( :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. + :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. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -315,21 +300,14 @@ async def begin_delete( 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) + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -341,6 +319,7 @@ def get_long_running_output(pipeline_response): ) 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( @@ -355,32 +334,22 @@ async def _update_initial( 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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = self._serialize.body(resource, 'ServiceResource') + + request = build_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + content_type=content_type, + json=_json, + template_url=self._update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -398,8 +367,11 @@ async def _update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}'} # type: ignore + + @distributed_trace_async async def begin_update( self, resource_group_name: str, @@ -418,15 +390,20 @@ async def begin_update( :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. + :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: + :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] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.ServiceResource"] lro_delay = kwargs.pop( 'polling_interval', @@ -438,27 +415,21 @@ async def begin_update( resource_group_name=resource_group_name, service_name=service_name, resource=resource, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_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) + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -470,8 +441,10 @@ def get_long_running_output(pipeline_response): ) 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 + @distributed_trace_async async def list_test_keys( self, resource_group_name: str, @@ -495,27 +468,17 @@ async def list_test_keys( 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 = build_list_test_keys_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + template_url=self.list_test_keys.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -529,8 +492,11 @@ async def list_test_keys( return cls(pipeline_response, deserialized, {}) return deserialized + list_test_keys.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/listTestKeys'} # type: ignore + + @distributed_trace_async async def regenerate_test_key( self, resource_group_name: str, @@ -546,7 +512,8 @@ async def regenerate_test_key( :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 + :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 @@ -557,32 +524,22 @@ async def regenerate_test_key( 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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = self._serialize.body(regenerate_test_key_request, 'RegenerateTestKeyRequestPayload') + + request = build_regenerate_test_key_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + content_type=content_type, + json=_json, + template_url=self.regenerate_test_key.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -596,8 +553,11 @@ async def regenerate_test_key( return cls(pipeline_response, deserialized, {}) return deserialized + regenerate_test_key.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/regenerateTestKey'} # type: ignore + + @distributed_trace_async async def disable_test_endpoint( self, resource_group_name: str, @@ -621,27 +581,17 @@ async def disable_test_endpoint( 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 = build_disable_test_endpoint_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + template_url=self.disable_test_endpoint.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -654,6 +604,8 @@ async def disable_test_endpoint( disable_test_endpoint.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/disableTestEndpoint'} # type: ignore + + @distributed_trace_async async def enable_test_endpoint( self, resource_group_name: str, @@ -677,27 +629,17 @@ async def enable_test_endpoint( 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 = build_enable_test_endpoint_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + template_url=self.enable_test_endpoint.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -711,8 +653,11 @@ async def enable_test_endpoint( return cls(pipeline_response, deserialized, {}) return deserialized + enable_test_endpoint.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/enableTestEndpoint'} # type: ignore + + @distributed_trace_async async def check_name_availability( self, location: str, @@ -724,7 +669,8 @@ async def check_name_availability( :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 + :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 @@ -735,31 +681,21 @@ async def check_name_availability( 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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = self._serialize.body(availability_parameters, 'NameAvailabilityParameters') + + request = build_check_name_availability_request( + subscription_id=self._config.subscription_id, + location=location, + content_type=content_type, + json=_json, + template_url=self.check_name_availability.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -773,8 +709,11 @@ async def check_name_availability( return cls(pipeline_response, deserialized, {}) return deserialized + check_name_availability.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.AppPlatform/locations/{location}/checkNameAvailability'} # type: ignore + + @distributed_trace def list_by_subscription( self, **kwargs: Any @@ -783,7 +722,8 @@ def list_by_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] + :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"] @@ -791,34 +731,29 @@ def list_by_subscription( 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) + + request = build_list_by_subscription_request( + subscription_id=self._config.subscription_id, + template_url=self.list_by_subscription.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_subscription_request( + subscription_id=self._config.subscription_id, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('ServiceResourceList', pipeline_response) + deserialized = self._deserialize("ServiceResourceList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -836,11 +771,13 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) list_by_subscription.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.AppPlatform/Spring'} # type: ignore + @distributed_trace def list( self, resource_group_name: str, @@ -853,7 +790,8 @@ def list( :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] + :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"] @@ -861,35 +799,31 @@ def list( 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) + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('ServiceResourceList', pipeline_response) + deserialized = self._deserialize("ServiceResourceList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -907,6 +841,7 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2020_11_01_preview/aio/operations/_skus_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2020_11_01_preview/aio/operations/_skus_operations.py index 7fe9f418d6295..6eee76f7a8051 100644 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2020_11_01_preview/aio/operations/_skus_operations.py +++ b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2020_11_01_preview/aio/operations/_skus_operations.py @@ -5,17 +5,22 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools 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.core.pipeline.transport import AsyncHttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._skus_operations import build_list_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -41,6 +46,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace def list( self, **kwargs: Any @@ -48,8 +54,10 @@ def list( """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] + :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"] @@ -57,34 +65,29 @@ def list( 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) + + request = build_list_request( + subscription_id=self._config.subscription_id, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('ResourceSkuCollection', pipeline_response) + deserialized = self._deserialize("ResourceSkuCollection", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -102,6 +105,7 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2020_11_01_preview/models/__init__.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2020_11_01_preview/models/__init__.py index 6ff92bf6005d4..b9aff01b2c2c3 100644 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2020_11_01_preview/models/__init__.py +++ b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2020_11_01_preview/models/__init__.py @@ -148,6 +148,7 @@ from ._models import UserSourceInfo # type: ignore from ._app_platform_management_client_enums import ( + ActionType, AppResourceProvisioningState, ConfigServerState, DeploymentResourceProvisioningState, @@ -236,6 +237,7 @@ 'TestKeys', 'TrackedResource', 'UserSourceInfo', + 'ActionType', 'AppResourceProvisioningState', 'ConfigServerState', 'DeploymentResourceProvisioningState', diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2020_11_01_preview/models/_app_platform_management_client_enums.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2020_11_01_preview/models/_app_platform_management_client_enums.py index 5ac8dede62c02..483260921151a 100644 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2020_11_01_preview/models/_app_platform_management_client_enums.py +++ b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2020_11_01_preview/models/_app_platform_management_client_enums.py @@ -6,27 +6,18 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from enum import Enum, EnumMeta +from enum import Enum from six import with_metaclass +from azure.core import CaseInsensitiveEnumMeta -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 ActionType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): + """Enum. Indicates the action type. "Internal" refers to actions that are for internal only APIs. + """ + INTERNAL = "Internal" -class AppResourceProvisioningState(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class AppResourceProvisioningState(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Provisioning state of the App """ @@ -35,7 +26,7 @@ class AppResourceProvisioningState(with_metaclass(_CaseInsensitiveEnumMeta, str, CREATING = "Creating" UPDATING = "Updating" -class ConfigServerState(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class ConfigServerState(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """State of the config server. """ @@ -45,7 +36,7 @@ class ConfigServerState(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): SUCCEEDED = "Succeeded" UPDATING = "Updating" -class DeploymentResourceProvisioningState(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class DeploymentResourceProvisioningState(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Provisioning state of the Deployment """ @@ -54,7 +45,7 @@ class DeploymentResourceProvisioningState(with_metaclass(_CaseInsensitiveEnumMet SUCCEEDED = "Succeeded" FAILED = "Failed" -class DeploymentResourceStatus(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class DeploymentResourceStatus(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Status of the Deployment """ @@ -66,7 +57,7 @@ class DeploymentResourceStatus(with_metaclass(_CaseInsensitiveEnumMeta, str, Enu UPGRADING = "Upgrading" COMPILING = "Compiling" -class ManagedIdentityType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class ManagedIdentityType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Type of the managed identity """ @@ -75,7 +66,7 @@ class ManagedIdentityType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): USER_ASSIGNED = "UserAssigned" SYSTEM_ASSIGNED_USER_ASSIGNED = "SystemAssigned,UserAssigned" -class MonitoringSettingState(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class MonitoringSettingState(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """State of the Monitoring Setting. """ @@ -84,7 +75,7 @@ class MonitoringSettingState(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum) SUCCEEDED = "Succeeded" UPDATING = "Updating" -class ProvisioningState(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class ProvisioningState(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Provisioning state of the Service """ @@ -98,7 +89,7 @@ class ProvisioningState(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): MOVED = "Moved" MOVE_FAILED = "MoveFailed" -class ResourceSkuRestrictionsReasonCode(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class ResourceSkuRestrictionsReasonCode(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Gets the reason for restriction. Possible values include: 'QuotaId', 'NotAvailableForSubscription' """ @@ -106,14 +97,14 @@ class ResourceSkuRestrictionsReasonCode(with_metaclass(_CaseInsensitiveEnumMeta, QUOTA_ID = "QuotaId" NOT_AVAILABLE_FOR_SUBSCRIPTION = "NotAvailableForSubscription" -class ResourceSkuRestrictionsType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +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)): +class RuntimeVersion(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Runtime version """ @@ -121,7 +112,7 @@ class RuntimeVersion(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): JAVA11 = "Java_11" NET_CORE31 = "NetCore_31" -class SkuScaleType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class SkuScaleType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Gets or sets the type of the scale. """ @@ -129,14 +120,14 @@ class SkuScaleType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): MANUAL = "Manual" AUTOMATIC = "Automatic" -class SupportedRuntimePlatform(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +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)): +class SupportedRuntimeValue(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The raw value which could be passed to deployment CRUD operations. """ @@ -144,21 +135,21 @@ class SupportedRuntimeValue(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)) JAVA11 = "Java_11" NET_CORE31 = "NetCore_31" -class TestKeyType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class TestKeyType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Type of the test key """ PRIMARY = "Primary" SECONDARY = "Secondary" -class TrafficDirection(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class TrafficDirection(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The direction of required traffic """ INBOUND = "Inbound" OUTBOUND = "Outbound" -class UserSourceType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class UserSourceType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Type of the source uploaded """ diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2020_11_01_preview/models/_models.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2020_11_01_preview/models/_models.py index 6a3b321f02f43..9398c5f7e0694 100644 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2020_11_01_preview/models/_models.py +++ b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2020_11_01_preview/models/_models.py @@ -30,6 +30,8 @@ def __init__( self, **kwargs ): + """ + """ super(ApplicationInsightsAgentVersions, self).__init__(**kwargs) self.java = None @@ -63,6 +65,8 @@ def __init__( self, **kwargs ): + """ + """ super(Resource, self).__init__(**kwargs) self.id = None self.name = None @@ -98,6 +102,8 @@ def __init__( self, **kwargs ): + """ + """ super(ProxyResource, self).__init__(**kwargs) @@ -112,12 +118,12 @@ 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. - :type location: str + :ivar properties: Properties of the App resource. + :vartype properties: ~azure.mgmt.appplatform.v2020_11_01_preview.models.AppResourceProperties + :ivar identity: The Managed Identity type of the app resource. + :vartype identity: ~azure.mgmt.appplatform.v2020_11_01_preview.models.ManagedIdentityProperties + :ivar location: The GEO location of the application, always the same with its parent resource. + :vartype location: str """ _validation = { @@ -139,6 +145,16 @@ def __init__( self, **kwargs ): + """ + :keyword properties: Properties of the App resource. + :paramtype properties: ~azure.mgmt.appplatform.v2020_11_01_preview.models.AppResourceProperties + :keyword identity: The Managed Identity type of the app resource. + :paramtype identity: + ~azure.mgmt.appplatform.v2020_11_01_preview.models.ManagedIdentityProperties + :keyword location: The GEO location of the application, always the same with its parent + resource. + :paramtype location: str + """ super(AppResource, self).__init__(**kwargs) self.properties = kwargs.get('properties', None) self.identity = kwargs.get('identity', None) @@ -148,11 +164,11 @@ def __init__( 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). + :ivar value: Collection of App resources. + :vartype value: list[~azure.mgmt.appplatform.v2020_11_01_preview.models.AppResource] + :ivar 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 + :vartype next_link: str """ _attribute_map = { @@ -164,6 +180,13 @@ def __init__( self, **kwargs ): + """ + :keyword value: Collection of App resources. + :paramtype value: list[~azure.mgmt.appplatform.v2020_11_01_preview.models.AppResource] + :keyword next_link: URL client should use to fetch the next page (per server side paging). + It's null for now, added for future use. + :paramtype next_link: str + """ super(AppResourceCollection, self).__init__(**kwargs) self.value = kwargs.get('value', None) self.next_link = kwargs.get('next_link', None) @@ -174,28 +197,28 @@ class AppResourceProperties(msrest.serialization.Model): Variables are only populated by the server, and will be ignored when sending a request. - :param public: Indicates whether the App exposes public endpoint. - :type public: bool + :ivar public: Indicates whether the App exposes public endpoint. + :vartype public: bool :ivar url: URL of the App. :vartype url: str :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. - :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 active_deployment_name: Name of the active deployment of the App. + :vartype active_deployment_name: str + :ivar fqdn: Fully qualified dns Name. + :vartype fqdn: str + :ivar https_only: Indicate if only https is allowed. + :vartype https_only: bool :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 + :ivar temporary_disk: Temporary disk settings. + :vartype temporary_disk: ~azure.mgmt.appplatform.v2020_11_01_preview.models.TemporaryDisk + :ivar persistent_disk: Persistent disk settings. + :vartype persistent_disk: ~azure.mgmt.appplatform.v2020_11_01_preview.models.PersistentDisk + :ivar enable_end_to_end_tls: Indicate if end to end TLS is enabled. + :vartype enable_end_to_end_tls: bool """ _validation = { @@ -221,6 +244,22 @@ def __init__( self, **kwargs ): + """ + :keyword public: Indicates whether the App exposes public endpoint. + :paramtype public: bool + :keyword active_deployment_name: Name of the active deployment of the App. + :paramtype active_deployment_name: str + :keyword fqdn: Fully qualified dns Name. + :paramtype fqdn: str + :keyword https_only: Indicate if only https is allowed. + :paramtype https_only: bool + :keyword temporary_disk: Temporary disk settings. + :paramtype temporary_disk: ~azure.mgmt.appplatform.v2020_11_01_preview.models.TemporaryDisk + :keyword persistent_disk: Persistent disk settings. + :paramtype persistent_disk: ~azure.mgmt.appplatform.v2020_11_01_preview.models.PersistentDisk + :keyword enable_end_to_end_tls: Indicate if end to end TLS is enabled. + :paramtype enable_end_to_end_tls: bool + """ super(AppResourceProperties, self).__init__(**kwargs) self.public = kwargs.get('public', None) self.url = None @@ -237,11 +276,11 @@ def __init__( 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). + :ivar value: Collection of available operation details. + :vartype value: list[~azure.mgmt.appplatform.v2020_11_01_preview.models.OperationDetail] + :ivar 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 + :vartype next_link: str """ _attribute_map = { @@ -253,6 +292,13 @@ def __init__( self, **kwargs ): + """ + :keyword value: Collection of available operation details. + :paramtype value: list[~azure.mgmt.appplatform.v2020_11_01_preview.models.OperationDetail] + :keyword next_link: URL client should use to fetch the next page (per server side paging). + It's null for now, added for future use. + :paramtype next_link: str + """ super(AvailableOperations, self).__init__(**kwargs) self.value = kwargs.get('value', None) self.next_link = kwargs.get('next_link', None) @@ -280,6 +326,8 @@ def __init__( self, **kwargs ): + """ + """ super(AvailableRuntimeVersions, self).__init__(**kwargs) self.value = None @@ -295,8 +343,9 @@ 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 + :ivar properties: Properties of the Binding resource. + :vartype properties: + ~azure.mgmt.appplatform.v2020_11_01_preview.models.BindingResourceProperties """ _validation = { @@ -316,6 +365,11 @@ def __init__( self, **kwargs ): + """ + :keyword properties: Properties of the Binding resource. + :paramtype properties: + ~azure.mgmt.appplatform.v2020_11_01_preview.models.BindingResourceProperties + """ super(BindingResource, self).__init__(**kwargs) self.properties = kwargs.get('properties', None) @@ -323,11 +377,11 @@ def __init__( 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). + :ivar value: Collection of Binding resources. + :vartype value: list[~azure.mgmt.appplatform.v2020_11_01_preview.models.BindingResource] + :ivar 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 + :vartype next_link: str """ _attribute_map = { @@ -339,6 +393,13 @@ def __init__( self, **kwargs ): + """ + :keyword value: Collection of Binding resources. + :paramtype value: list[~azure.mgmt.appplatform.v2020_11_01_preview.models.BindingResource] + :keyword next_link: URL client should use to fetch the next page (per server side paging). + It's null for now, added for future use. + :paramtype next_link: str + """ super(BindingResourceCollection, self).__init__(**kwargs) self.value = kwargs.get('value', None) self.next_link = kwargs.get('next_link', None) @@ -353,12 +414,12 @@ class BindingResourceProperties(msrest.serialization.Model): :vartype resource_name: str :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. - :type resource_id: str - :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, any] + :ivar resource_id: The Azure resource id of the bound resource. + :vartype resource_id: str + :ivar key: The key of the bound resource. + :vartype key: str + :ivar binding_parameters: Binding parameters of the Binding resource. + :vartype 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 @@ -391,6 +452,14 @@ def __init__( self, **kwargs ): + """ + :keyword resource_id: The Azure resource id of the bound resource. + :paramtype resource_id: str + :keyword key: The key of the bound resource. + :paramtype key: str + :keyword binding_parameters: Binding parameters of the Binding resource. + :paramtype binding_parameters: dict[str, any] + """ super(BindingResourceProperties, self).__init__(**kwargs) self.resource_name = None self.resource_type = None @@ -411,12 +480,12 @@ class CertificateProperties(msrest.serialization.Model): :ivar thumbprint: The thumbprint of certificate. :vartype thumbprint: str - :param vault_uri: Required. The vault uri of user key vault. - :type vault_uri: str - :param key_vault_cert_name: Required. The certificate name of key vault. - :type key_vault_cert_name: str - :param cert_version: The certificate version of key vault. - :type cert_version: str + :ivar vault_uri: Required. The vault uri of user key vault. + :vartype vault_uri: str + :ivar key_vault_cert_name: Required. The certificate name of key vault. + :vartype key_vault_cert_name: str + :ivar cert_version: The certificate version of key vault. + :vartype cert_version: str :ivar issuer: The issuer of certificate. :vartype issuer: str :ivar issued_date: The issue date of certificate. @@ -460,6 +529,14 @@ def __init__( self, **kwargs ): + """ + :keyword vault_uri: Required. The vault uri of user key vault. + :paramtype vault_uri: str + :keyword key_vault_cert_name: Required. The certificate name of key vault. + :paramtype key_vault_cert_name: str + :keyword cert_version: The certificate version of key vault. + :paramtype cert_version: str + """ super(CertificateProperties, self).__init__(**kwargs) self.thumbprint = None self.vault_uri = kwargs['vault_uri'] @@ -484,8 +561,8 @@ class CertificateResource(ProxyResource): :vartype name: str :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 + :ivar properties: Properties of the certificate resource payload. + :vartype properties: ~azure.mgmt.appplatform.v2020_11_01_preview.models.CertificateProperties """ _validation = { @@ -505,6 +582,10 @@ def __init__( self, **kwargs ): + """ + :keyword properties: Properties of the certificate resource payload. + :paramtype properties: ~azure.mgmt.appplatform.v2020_11_01_preview.models.CertificateProperties + """ super(CertificateResource, self).__init__(**kwargs) self.properties = kwargs.get('properties', None) @@ -512,10 +593,10 @@ def __init__( class CertificateResourceCollection(msrest.serialization.Model): """Collection compose of certificate resources list and a possible link for next page. - :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 + :ivar value: The certificate resources list. + :vartype value: list[~azure.mgmt.appplatform.v2020_11_01_preview.models.CertificateResource] + :ivar next_link: The link to next page of certificate list. + :vartype next_link: str """ _attribute_map = { @@ -527,6 +608,12 @@ def __init__( self, **kwargs ): + """ + :keyword value: The certificate resources list. + :paramtype value: list[~azure.mgmt.appplatform.v2020_11_01_preview.models.CertificateResource] + :keyword next_link: The link to next page of certificate list. + :paramtype next_link: str + """ super(CertificateResourceCollection, self).__init__(**kwargs) self.value = kwargs.get('value', None) self.next_link = kwargs.get('next_link', None) @@ -535,17 +622,17 @@ def __init__( 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 + :ivar 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 + :vartype code: str + :ivar 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 + :vartype message: str + :ivar 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] + :vartype target: str + :ivar details: A list of additional details about the error. + :vartype details: list[~azure.mgmt.appplatform.v2020_11_01_preview.models.CloudErrorBody] """ _attribute_map = { @@ -559,6 +646,19 @@ def __init__( self, **kwargs ): + """ + :keyword code: An identifier for the error. Codes are invariant and are intended to be consumed + programmatically. + :paramtype code: str + :keyword message: A message describing the error, intended to be suitable for display in a user + interface. + :paramtype message: str + :keyword target: The target of the particular error. For example, the name of the property in + error. + :paramtype target: str + :keyword details: A list of additional details about the error. + :paramtype details: list[~azure.mgmt.appplatform.v2020_11_01_preview.models.CloudErrorBody] + """ super(CloudErrorBody, self).__init__(**kwargs) self.code = kwargs.get('code', None) self.message = kwargs.get('message', None) @@ -576,8 +676,8 @@ class ClusterResourceProperties(msrest.serialization.Model): "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 network_profile: Network profile of the Service. + :vartype 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. @@ -601,6 +701,10 @@ def __init__( self, **kwargs ): + """ + :keyword network_profile: Network profile of the Service. + :paramtype network_profile: ~azure.mgmt.appplatform.v2020_11_01_preview.models.NetworkProfile + """ super(ClusterResourceProperties, self).__init__(**kwargs) self.provisioning_state = None self.network_profile = kwargs.get('network_profile', None) @@ -613,27 +717,27 @@ class ConfigServerGitProperty(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param repositories: Repositories of git. - :type repositories: + :ivar repositories: Repositories of git. + :vartype repositories: list[~azure.mgmt.appplatform.v2020_11_01_preview.models.GitPatternRepository] - :param uri: Required. URI of the repository. - :type uri: str - :param label: Label of the repository. - :type label: str - :param search_paths: Searching path of the repository. - :type search_paths: list[str] - :param username: Username of git repository basic auth. - :type username: str - :param password: Password of git repository basic auth. - :type password: str - :param host_key: Public sshKey of git repository. - :type host_key: str - :param host_key_algorithm: SshKey algorithm of git repository. - :type host_key_algorithm: str - :param private_key: Private sshKey algorithm of git repository. - :type private_key: str - :param strict_host_key_checking: Strict host key checking or not. - :type strict_host_key_checking: bool + :ivar uri: Required. URI of the repository. + :vartype uri: str + :ivar label: Label of the repository. + :vartype label: str + :ivar search_paths: Searching path of the repository. + :vartype search_paths: list[str] + :ivar username: Username of git repository basic auth. + :vartype username: str + :ivar password: Password of git repository basic auth. + :vartype password: str + :ivar host_key: Public sshKey of git repository. + :vartype host_key: str + :ivar host_key_algorithm: SshKey algorithm of git repository. + :vartype host_key_algorithm: str + :ivar private_key: Private sshKey algorithm of git repository. + :vartype private_key: str + :ivar strict_host_key_checking: Strict host key checking or not. + :vartype strict_host_key_checking: bool """ _validation = { @@ -657,6 +761,29 @@ def __init__( self, **kwargs ): + """ + :keyword repositories: Repositories of git. + :paramtype repositories: + list[~azure.mgmt.appplatform.v2020_11_01_preview.models.GitPatternRepository] + :keyword uri: Required. URI of the repository. + :paramtype uri: str + :keyword label: Label of the repository. + :paramtype label: str + :keyword search_paths: Searching path of the repository. + :paramtype search_paths: list[str] + :keyword username: Username of git repository basic auth. + :paramtype username: str + :keyword password: Password of git repository basic auth. + :paramtype password: str + :keyword host_key: Public sshKey of git repository. + :paramtype host_key: str + :keyword host_key_algorithm: SshKey algorithm of git repository. + :paramtype host_key_algorithm: str + :keyword private_key: Private sshKey algorithm of git repository. + :paramtype private_key: str + :keyword strict_host_key_checking: Strict host key checking or not. + :paramtype strict_host_key_checking: bool + """ super(ConfigServerGitProperty, self).__init__(**kwargs) self.repositories = kwargs.get('repositories', None) self.uri = kwargs['uri'] @@ -679,10 +806,10 @@ class ConfigServerProperties(msrest.serialization.Model): "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 + :ivar error: Error when apply config server settings. + :vartype error: ~azure.mgmt.appplatform.v2020_11_01_preview.models.Error + :ivar config_server: Settings of config server. + :vartype config_server: ~azure.mgmt.appplatform.v2020_11_01_preview.models.ConfigServerSettings """ _validation = { @@ -699,6 +826,13 @@ def __init__( self, **kwargs ): + """ + :keyword error: Error when apply config server settings. + :paramtype error: ~azure.mgmt.appplatform.v2020_11_01_preview.models.Error + :keyword config_server: Settings of config server. + :paramtype config_server: + ~azure.mgmt.appplatform.v2020_11_01_preview.models.ConfigServerSettings + """ super(ConfigServerProperties, self).__init__(**kwargs) self.provisioning_state = None self.error = kwargs.get('error', None) @@ -716,8 +850,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 + :ivar properties: Properties of the Config Server resource. + :vartype properties: ~azure.mgmt.appplatform.v2020_11_01_preview.models.ConfigServerProperties """ _validation = { @@ -737,6 +871,11 @@ def __init__( self, **kwargs ): + """ + :keyword properties: Properties of the Config Server resource. + :paramtype properties: + ~azure.mgmt.appplatform.v2020_11_01_preview.models.ConfigServerProperties + """ super(ConfigServerResource, self).__init__(**kwargs) self.properties = kwargs.get('properties', None) @@ -744,8 +883,9 @@ def __init__( 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 + :ivar git_property: Property of git environment. + :vartype git_property: + ~azure.mgmt.appplatform.v2020_11_01_preview.models.ConfigServerGitProperty """ _attribute_map = { @@ -756,6 +896,11 @@ def __init__( self, **kwargs ): + """ + :keyword git_property: Property of git environment. + :paramtype git_property: + ~azure.mgmt.appplatform.v2020_11_01_preview.models.ConfigServerGitProperty + """ super(ConfigServerSettings, self).__init__(**kwargs) self.git_property = kwargs.get('git_property', None) @@ -763,12 +908,12 @@ def __init__( class ConfigServerSettingsErrorRecord(msrest.serialization.Model): """Error record of the config server settings. - :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. - :type uri: str - :param messages: The detail error messages of the record. - :type messages: list[str] + :ivar name: The name of the config server settings error record. + :vartype name: str + :ivar uri: The uri of the config server settings error record. + :vartype uri: str + :ivar messages: The detail error messages of the record. + :vartype messages: list[str] """ _attribute_map = { @@ -781,6 +926,14 @@ def __init__( self, **kwargs ): + """ + :keyword name: The name of the config server settings error record. + :paramtype name: str + :keyword uri: The uri of the config server settings error record. + :paramtype uri: str + :keyword messages: The detail error messages of the record. + :paramtype messages: list[str] + """ super(ConfigServerSettingsErrorRecord, self).__init__(**kwargs) self.name = kwargs.get('name', None) self.uri = kwargs.get('uri', None) @@ -790,10 +943,10 @@ def __init__( class ConfigServerSettingsValidateResult(msrest.serialization.Model): """Validation result for config server settings. - :param is_valid: Indicate if the config server settings are valid. - :type is_valid: bool - :param details: The detail validation results. - :type details: + :ivar is_valid: Indicate if the config server settings are valid. + :vartype is_valid: bool + :ivar details: The detail validation results. + :vartype details: list[~azure.mgmt.appplatform.v2020_11_01_preview.models.ConfigServerSettingsErrorRecord] """ @@ -806,6 +959,13 @@ def __init__( self, **kwargs ): + """ + :keyword is_valid: Indicate if the config server settings are valid. + :paramtype is_valid: bool + :keyword details: The detail validation results. + :paramtype details: + list[~azure.mgmt.appplatform.v2020_11_01_preview.models.ConfigServerSettingsErrorRecord] + """ super(ConfigServerSettingsValidateResult, self).__init__(**kwargs) self.is_valid = kwargs.get('is_valid', None) self.details = kwargs.get('details', None) @@ -816,12 +976,12 @@ class CustomDomainProperties(msrest.serialization.Model): 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 + :ivar thumbprint: The thumbprint of bound certificate. + :vartype thumbprint: str :ivar app_name: The app name of domain. :vartype app_name: str - :param cert_name: The bound certificate name of domain. - :type cert_name: str + :ivar cert_name: The bound certificate name of domain. + :vartype cert_name: str """ _validation = { @@ -838,6 +998,12 @@ def __init__( self, **kwargs ): + """ + :keyword thumbprint: The thumbprint of bound certificate. + :paramtype thumbprint: str + :keyword cert_name: The bound certificate name of domain. + :paramtype cert_name: str + """ super(CustomDomainProperties, self).__init__(**kwargs) self.thumbprint = kwargs.get('thumbprint', None) self.app_name = None @@ -855,8 +1021,8 @@ class CustomDomainResource(ProxyResource): :vartype name: str :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 + :ivar properties: Properties of the custom domain resource. + :vartype properties: ~azure.mgmt.appplatform.v2020_11_01_preview.models.CustomDomainProperties """ _validation = { @@ -876,6 +1042,11 @@ def __init__( self, **kwargs ): + """ + :keyword properties: Properties of the custom domain resource. + :paramtype properties: + ~azure.mgmt.appplatform.v2020_11_01_preview.models.CustomDomainProperties + """ super(CustomDomainResource, self).__init__(**kwargs) self.properties = kwargs.get('properties', None) @@ -883,10 +1054,10 @@ def __init__( 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 + :ivar value: The custom domain resources list. + :vartype value: list[~azure.mgmt.appplatform.v2020_11_01_preview.models.CustomDomainResource] + :ivar next_link: The link to next page of custom domain list. + :vartype next_link: str """ _attribute_map = { @@ -898,6 +1069,12 @@ def __init__( self, **kwargs ): + """ + :keyword value: The custom domain resources list. + :paramtype value: list[~azure.mgmt.appplatform.v2020_11_01_preview.models.CustomDomainResource] + :keyword next_link: The link to next page of custom domain list. + :paramtype next_link: str + """ super(CustomDomainResourceCollection, self).__init__(**kwargs) self.value = kwargs.get('value', None) self.next_link = kwargs.get('next_link', None) @@ -908,8 +1085,8 @@ class CustomDomainValidatePayload(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param name: Required. Name to be validated. - :type name: str + :ivar name: Required. Name to be validated. + :vartype name: str """ _validation = { @@ -924,6 +1101,10 @@ def __init__( self, **kwargs ): + """ + :keyword name: Required. Name to be validated. + :paramtype name: str + """ super(CustomDomainValidatePayload, self).__init__(**kwargs) self.name = kwargs['name'] @@ -931,10 +1112,10 @@ def __init__( class CustomDomainValidateResult(msrest.serialization.Model): """Validation result for custom domain. - :param is_valid: Indicates if domain name is valid. - :type is_valid: bool - :param message: Message of why domain name is invalid. - :type message: str + :ivar is_valid: Indicates if domain name is valid. + :vartype is_valid: bool + :ivar message: Message of why domain name is invalid. + :vartype message: str """ _attribute_map = { @@ -946,6 +1127,12 @@ def __init__( self, **kwargs ): + """ + :keyword is_valid: Indicates if domain name is valid. + :paramtype is_valid: bool + :keyword message: Message of why domain name is invalid. + :paramtype message: str + """ super(CustomDomainValidateResult, self).__init__(**kwargs) self.is_valid = kwargs.get('is_valid', None) self.message = kwargs.get('message', None) @@ -988,6 +1175,8 @@ def __init__( self, **kwargs ): + """ + """ super(DeploymentInstance, self).__init__(**kwargs) self.name = None self.status = None @@ -1007,11 +1196,11 @@ 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: + :ivar properties: Properties of the Deployment resource. + :vartype 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 + :ivar sku: Sku of the Deployment resource. + :vartype sku: ~azure.mgmt.appplatform.v2020_11_01_preview.models.Sku """ _validation = { @@ -1032,6 +1221,13 @@ def __init__( self, **kwargs ): + """ + :keyword properties: Properties of the Deployment resource. + :paramtype properties: + ~azure.mgmt.appplatform.v2020_11_01_preview.models.DeploymentResourceProperties + :keyword sku: Sku of the Deployment resource. + :paramtype sku: ~azure.mgmt.appplatform.v2020_11_01_preview.models.Sku + """ super(DeploymentResource, self).__init__(**kwargs) self.properties = kwargs.get('properties', None) self.sku = kwargs.get('sku', None) @@ -1040,11 +1236,11 @@ def __init__( 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). + :ivar value: Collection of Deployment resources. + :vartype value: list[~azure.mgmt.appplatform.v2020_11_01_preview.models.DeploymentResource] + :ivar 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 + :vartype next_link: str """ _attribute_map = { @@ -1056,6 +1252,13 @@ def __init__( self, **kwargs ): + """ + :keyword value: Collection of Deployment resources. + :paramtype value: list[~azure.mgmt.appplatform.v2020_11_01_preview.models.DeploymentResource] + :keyword next_link: URL client should use to fetch the next page (per server side paging). + It's null for now, added for future use. + :paramtype next_link: str + """ super(DeploymentResourceCollection, self).__init__(**kwargs) self.value = kwargs.get('value', None) self.next_link = kwargs.get('next_link', None) @@ -1066,12 +1269,12 @@ class DeploymentResourceProperties(msrest.serialization.Model): 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 source: Uploaded source information of the deployment. + :vartype 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. - :type deployment_settings: + :ivar deployment_settings: Deployment settings of the Deployment. + :vartype 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". @@ -1113,6 +1316,13 @@ def __init__( self, **kwargs ): + """ + :keyword source: Uploaded source information of the deployment. + :paramtype source: ~azure.mgmt.appplatform.v2020_11_01_preview.models.UserSourceInfo + :keyword deployment_settings: Deployment settings of the Deployment. + :paramtype deployment_settings: + ~azure.mgmt.appplatform.v2020_11_01_preview.models.DeploymentSettings + """ super(DeploymentResourceProperties, self).__init__(**kwargs) self.source = kwargs.get('source', None) self.app_name = None @@ -1127,20 +1337,21 @@ def __init__( 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). - :type cpu: int - :param memory_in_gb: Required Memory size in GB, basic tier should be in range (1, 2), standard + :ivar cpu: Required CPU, basic tier should be 1, standard tier should be in range (1, 4). + :vartype cpu: int + :ivar 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. - :type jvm_options: str - :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. - :type environment_variables: dict[str, str] - :param runtime_version: Runtime version. Possible values include: "Java_8", "Java_11", + :vartype memory_in_gb: int + :ivar jvm_options: JVM parameter. + :vartype jvm_options: str + :ivar net_core_main_entry_path: The path to the .NET executable relative to zip root. + :vartype net_core_main_entry_path: str + :ivar environment_variables: Collection of environment variables. + :vartype environment_variables: dict[str, str] + :ivar 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 + :vartype runtime_version: str or + ~azure.mgmt.appplatform.v2020_11_01_preview.models.RuntimeVersion """ _attribute_map = { @@ -1156,6 +1367,23 @@ def __init__( self, **kwargs ): + """ + :keyword cpu: Required CPU, basic tier should be 1, standard tier should be in range (1, 4). + :paramtype cpu: int + :keyword memory_in_gb: Required Memory size in GB, basic tier should be in range (1, 2), + standard tier should be in range (1, 8). + :paramtype memory_in_gb: int + :keyword jvm_options: JVM parameter. + :paramtype jvm_options: str + :keyword net_core_main_entry_path: The path to the .NET executable relative to zip root. + :paramtype net_core_main_entry_path: str + :keyword environment_variables: Collection of environment variables. + :paramtype environment_variables: dict[str, str] + :keyword runtime_version: Runtime version. Possible values include: "Java_8", "Java_11", + "NetCore_31". Default value: "Java_8". + :paramtype runtime_version: str or + ~azure.mgmt.appplatform.v2020_11_01_preview.models.RuntimeVersion + """ super(DeploymentSettings, self).__init__(**kwargs) self.cpu = kwargs.get('cpu', 1) self.memory_in_gb = kwargs.get('memory_in_gb', 1) @@ -1168,10 +1396,10 @@ def __init__( class Error(msrest.serialization.Model): """The error code compose of code and message. - :param code: The code of error. - :type code: str - :param message: The message of error. - :type message: str + :ivar code: The code of error. + :vartype code: str + :ivar message: The message of error. + :vartype message: str """ _attribute_map = { @@ -1183,6 +1411,12 @@ def __init__( self, **kwargs ): + """ + :keyword code: The code of error. + :paramtype code: str + :keyword message: The message of error. + :paramtype message: str + """ super(Error, self).__init__(**kwargs) self.code = kwargs.get('code', None) self.message = kwargs.get('message', None) @@ -1193,28 +1427,28 @@ class GitPatternRepository(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param name: Required. Name of the repository. - :type name: str - :param pattern: Collection of pattern of the repository. - :type pattern: list[str] - :param uri: Required. URI of the repository. - :type uri: str - :param label: Label of the repository. - :type label: str - :param search_paths: Searching path of the repository. - :type search_paths: list[str] - :param username: Username of git repository basic auth. - :type username: str - :param password: Password of git repository basic auth. - :type password: str - :param host_key: Public sshKey of git repository. - :type host_key: str - :param host_key_algorithm: SshKey algorithm of git repository. - :type host_key_algorithm: str - :param private_key: Private sshKey algorithm of git repository. - :type private_key: str - :param strict_host_key_checking: Strict host key checking or not. - :type strict_host_key_checking: bool + :ivar name: Required. Name of the repository. + :vartype name: str + :ivar pattern: Collection of pattern of the repository. + :vartype pattern: list[str] + :ivar uri: Required. URI of the repository. + :vartype uri: str + :ivar label: Label of the repository. + :vartype label: str + :ivar search_paths: Searching path of the repository. + :vartype search_paths: list[str] + :ivar username: Username of git repository basic auth. + :vartype username: str + :ivar password: Password of git repository basic auth. + :vartype password: str + :ivar host_key: Public sshKey of git repository. + :vartype host_key: str + :ivar host_key_algorithm: SshKey algorithm of git repository. + :vartype host_key_algorithm: str + :ivar private_key: Private sshKey algorithm of git repository. + :vartype private_key: str + :ivar strict_host_key_checking: Strict host key checking or not. + :vartype strict_host_key_checking: bool """ _validation = { @@ -1240,6 +1474,30 @@ def __init__( self, **kwargs ): + """ + :keyword name: Required. Name of the repository. + :paramtype name: str + :keyword pattern: Collection of pattern of the repository. + :paramtype pattern: list[str] + :keyword uri: Required. URI of the repository. + :paramtype uri: str + :keyword label: Label of the repository. + :paramtype label: str + :keyword search_paths: Searching path of the repository. + :paramtype search_paths: list[str] + :keyword username: Username of git repository basic auth. + :paramtype username: str + :keyword password: Password of git repository basic auth. + :paramtype password: str + :keyword host_key: Public sshKey of git repository. + :paramtype host_key: str + :keyword host_key_algorithm: SshKey algorithm of git repository. + :paramtype host_key_algorithm: str + :keyword private_key: Private sshKey algorithm of git repository. + :paramtype private_key: str + :keyword strict_host_key_checking: Strict host key checking or not. + :paramtype strict_host_key_checking: bool + """ super(GitPatternRepository, self).__init__(**kwargs) self.name = kwargs['name'] self.pattern = kwargs.get('pattern', None) @@ -1259,8 +1517,8 @@ class LogFileUrlResponse(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param url: Required. URL of the log file. - :type url: str + :ivar url: Required. URL of the log file. + :vartype url: str """ _validation = { @@ -1275,6 +1533,10 @@ def __init__( self, **kwargs ): + """ + :keyword url: Required. URL of the log file. + :paramtype url: str + """ super(LogFileUrlResponse, self).__init__(**kwargs) self.url = kwargs['url'] @@ -1282,12 +1544,12 @@ def __init__( class LogSpecification(msrest.serialization.Model): """Specifications of the Log for Azure Monitoring. - :param name: Name of the log. - :type name: str - :param display_name: Localized friendly display name of the log. - :type display_name: str - :param blob_duration: Blob duration of the log. - :type blob_duration: str + :ivar name: Name of the log. + :vartype name: str + :ivar display_name: Localized friendly display name of the log. + :vartype display_name: str + :ivar blob_duration: Blob duration of the log. + :vartype blob_duration: str """ _attribute_map = { @@ -1300,6 +1562,14 @@ def __init__( self, **kwargs ): + """ + :keyword name: Name of the log. + :paramtype name: str + :keyword display_name: Localized friendly display name of the log. + :paramtype display_name: str + :keyword blob_duration: Blob duration of the log. + :paramtype blob_duration: str + """ super(LogSpecification, self).__init__(**kwargs) self.name = kwargs.get('name', None) self.display_name = kwargs.get('display_name', None) @@ -1309,13 +1579,13 @@ def __init__( 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", + :ivar 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. - :type tenant_id: str + :vartype type: str or ~azure.mgmt.appplatform.v2020_11_01_preview.models.ManagedIdentityType + :ivar principal_id: Principal Id. + :vartype principal_id: str + :ivar tenant_id: Tenant Id. + :vartype tenant_id: str """ _attribute_map = { @@ -1328,6 +1598,15 @@ def __init__( self, **kwargs ): + """ + :keyword type: Type of the managed identity. Possible values include: "None", "SystemAssigned", + "UserAssigned", "SystemAssigned,UserAssigned". + :paramtype type: str or ~azure.mgmt.appplatform.v2020_11_01_preview.models.ManagedIdentityType + :keyword principal_id: Principal Id. + :paramtype principal_id: str + :keyword tenant_id: Tenant Id. + :paramtype tenant_id: str + """ super(ManagedIdentityProperties, self).__init__(**kwargs) self.type = kwargs.get('type', None) self.principal_id = kwargs.get('principal_id', None) @@ -1337,13 +1616,13 @@ def __init__( class MetricDimension(msrest.serialization.Model): """Specifications of the Dimension of metrics. - :param name: Name of the dimension. - :type name: str - :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 + :ivar name: Name of the dimension. + :vartype name: str + :ivar display_name: Localized friendly display name of the dimension. + :vartype display_name: str + :ivar to_be_exported_for_shoebox: Whether this dimension should be included for the Shoebox export scenario. - :type to_be_exported_for_shoebox: bool + :vartype to_be_exported_for_shoebox: bool """ _attribute_map = { @@ -1356,6 +1635,15 @@ def __init__( self, **kwargs ): + """ + :keyword name: Name of the dimension. + :paramtype name: str + :keyword display_name: Localized friendly display name of the dimension. + :paramtype display_name: str + :keyword to_be_exported_for_shoebox: Whether this dimension should be included for the Shoebox + export scenario. + :paramtype to_be_exported_for_shoebox: bool + """ super(MetricDimension, self).__init__(**kwargs) self.name = kwargs.get('name', None) self.display_name = kwargs.get('display_name', None) @@ -1365,29 +1653,31 @@ def __init__( class MetricSpecification(msrest.serialization.Model): """Specifications of the Metrics for Azure Monitoring. - :param name: Name of the metric. - :type name: str - :param display_name: Localized friendly display name of the metric. - :type display_name: str - :param display_description: Localized friendly description of the metric. - :type display_description: str - :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 + :ivar name: Name of the metric. + :vartype name: str + :ivar display_name: Localized friendly display name of the metric. + :vartype display_name: str + :ivar display_description: Localized friendly description of the metric. + :vartype display_description: str + :ivar unit: Unit that makes sense for the metric. + :vartype unit: str + :ivar 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, + :vartype category: str + :ivar 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. - :type supported_aggregation_types: list[str] - :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 + :vartype aggregation_type: str + :ivar supported_aggregation_types: Supported aggregation types. + :vartype supported_aggregation_types: list[str] + :ivar supported_time_grain_types: Supported time grain types. + :vartype supported_time_grain_types: list[str] + :ivar 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] + :vartype fill_gap_with_zero: bool + :ivar dimensions: Dimensions of the metric. + :vartype dimensions: list[~azure.mgmt.appplatform.v2020_11_01_preview.models.MetricDimension] + :ivar source_mdm_namespace: Name of the MDM namespace. Optional. + :vartype source_mdm_namespace: str """ _attribute_map = { @@ -1401,12 +1691,40 @@ class MetricSpecification(msrest.serialization.Model): 'supported_time_grain_types': {'key': 'supportedTimeGrainTypes', 'type': '[str]'}, 'fill_gap_with_zero': {'key': 'fillGapWithZero', 'type': 'bool'}, 'dimensions': {'key': 'dimensions', 'type': '[MetricDimension]'}, - } - - def __init__( - self, - **kwargs - ): + 'source_mdm_namespace': {'key': 'sourceMdmNamespace', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + """ + :keyword name: Name of the metric. + :paramtype name: str + :keyword display_name: Localized friendly display name of the metric. + :paramtype display_name: str + :keyword display_description: Localized friendly description of the metric. + :paramtype display_description: str + :keyword unit: Unit that makes sense for the metric. + :paramtype unit: str + :keyword category: Name of the metric category that the metric belongs to. A metric can only + belong to a single category. + :paramtype category: str + :keyword aggregation_type: Only provide one value for this field. Valid values: Average, + Minimum, Maximum, Total, Count. + :paramtype aggregation_type: str + :keyword supported_aggregation_types: Supported aggregation types. + :paramtype supported_aggregation_types: list[str] + :keyword supported_time_grain_types: Supported time grain types. + :paramtype supported_time_grain_types: list[str] + :keyword fill_gap_with_zero: Optional. If set to true, then zero will be returned for time + duration where no metric is emitted/published. + :paramtype fill_gap_with_zero: bool + :keyword dimensions: Dimensions of the metric. + :paramtype dimensions: list[~azure.mgmt.appplatform.v2020_11_01_preview.models.MetricDimension] + :keyword source_mdm_namespace: Name of the MDM namespace. Optional. + :paramtype source_mdm_namespace: str + """ super(MetricSpecification, self).__init__(**kwargs) self.name = kwargs.get('name', None) self.display_name = kwargs.get('display_name', None) @@ -1418,6 +1736,7 @@ def __init__( self.supported_time_grain_types = kwargs.get('supported_time_grain_types', None) self.fill_gap_with_zero = kwargs.get('fill_gap_with_zero', None) self.dimensions = kwargs.get('dimensions', None) + self.source_mdm_namespace = kwargs.get('source_mdm_namespace', None) class MonitoringSettingProperties(msrest.serialization.Model): @@ -1429,20 +1748,20 @@ class MonitoringSettingProperties(msrest.serialization.Model): "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. - :type trace_enabled: bool - :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, + :ivar error: Error when apply Monitoring Setting changes. + :vartype error: ~azure.mgmt.appplatform.v2020_11_01_preview.models.Error + :ivar 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. + :vartype trace_enabled: bool + :ivar app_insights_instrumentation_key: Target application insight instrumentation key, null or + whitespace include empty will disable monitoringSettings. + :vartype app_insights_instrumentation_key: str + :ivar 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. - :type app_insights_agent_versions: + :vartype app_insights_sampling_rate: float + :ivar app_insights_agent_versions: Indicates the versions of application insight agent. + :vartype app_insights_agent_versions: ~azure.mgmt.appplatform.v2020_11_01_preview.models.ApplicationInsightsAgentVersions """ @@ -1464,6 +1783,23 @@ def __init__( self, **kwargs ): + """ + :keyword error: Error when apply Monitoring Setting changes. + :paramtype error: ~azure.mgmt.appplatform.v2020_11_01_preview.models.Error + :keyword 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. + :paramtype trace_enabled: bool + :keyword app_insights_instrumentation_key: Target application insight instrumentation key, null + or whitespace include empty will disable monitoringSettings. + :paramtype app_insights_instrumentation_key: str + :keyword app_insights_sampling_rate: Indicates the sampling rate of application insight agent, + should be in range [0.0, 100.0]. + :paramtype app_insights_sampling_rate: float + :keyword app_insights_agent_versions: Indicates the versions of application insight agent. + :paramtype app_insights_agent_versions: + ~azure.mgmt.appplatform.v2020_11_01_preview.models.ApplicationInsightsAgentVersions + """ super(MonitoringSettingProperties, self).__init__(**kwargs) self.provisioning_state = None self.error = kwargs.get('error', None) @@ -1484,8 +1820,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: + :ivar properties: Properties of the Monitoring Setting resource. + :vartype properties: ~azure.mgmt.appplatform.v2020_11_01_preview.models.MonitoringSettingProperties """ @@ -1506,6 +1842,11 @@ def __init__( self, **kwargs ): + """ + :keyword properties: Properties of the Monitoring Setting resource. + :paramtype properties: + ~azure.mgmt.appplatform.v2020_11_01_preview.models.MonitoringSettingProperties + """ super(MonitoringSettingResource, self).__init__(**kwargs) self.properties = kwargs.get('properties', None) @@ -1513,12 +1854,12 @@ def __init__( class NameAvailability(msrest.serialization.Model): """Name availability result payload. - :param name_available: Indicates whether the name is available. - :type name_available: bool - :param reason: Reason why the name is not available. - :type reason: str - :param message: Message why the name is not available. - :type message: str + :ivar name_available: Indicates whether the name is available. + :vartype name_available: bool + :ivar reason: Reason why the name is not available. + :vartype reason: str + :ivar message: Message why the name is not available. + :vartype message: str """ _attribute_map = { @@ -1531,6 +1872,14 @@ def __init__( self, **kwargs ): + """ + :keyword name_available: Indicates whether the name is available. + :paramtype name_available: bool + :keyword reason: Reason why the name is not available. + :paramtype reason: str + :keyword message: Message why the name is not available. + :paramtype message: str + """ super(NameAvailability, self).__init__(**kwargs) self.name_available = kwargs.get('name_available', None) self.reason = kwargs.get('reason', None) @@ -1542,10 +1891,10 @@ class NameAvailabilityParameters(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param type: Required. Type of the resource to check name availability. - :type type: str - :param name: Required. Name to be checked. - :type name: str + :ivar type: Required. Type of the resource to check name availability. + :vartype type: str + :ivar name: Required. Name to be checked. + :vartype name: str """ _validation = { @@ -1562,6 +1911,12 @@ def __init__( self, **kwargs ): + """ + :keyword type: Required. Type of the resource to check name availability. + :paramtype type: str + :keyword name: Required. Name to be checked. + :paramtype name: str + """ super(NameAvailabilityParameters, self).__init__(**kwargs) self.type = kwargs['type'] self.name = kwargs['name'] @@ -1572,20 +1927,19 @@ class NetworkProfile(msrest.serialization.Model): 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. - :type service_runtime_subnet_id: str - :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. - :type service_cidr: str - :param service_runtime_network_resource_group: Name of the resource group containing network + :ivar service_runtime_subnet_id: Fully qualified resource Id of the subnet to host Azure Spring + Cloud Service Runtime. + :vartype service_runtime_subnet_id: str + :ivar app_subnet_id: Fully qualified resource Id of the subnet to host Azure Spring Cloud Apps. + :vartype app_subnet_id: str + :ivar service_cidr: Azure Spring Cloud service reserved CIDR. + :vartype service_cidr: str + :ivar 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 + :vartype service_runtime_network_resource_group: str + :ivar app_network_resource_group: Name of the resource group containing network resources of Azure Spring Cloud Apps. - :type app_network_resource_group: str + :vartype app_network_resource_group: str :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 @@ -1613,6 +1967,22 @@ def __init__( self, **kwargs ): + """ + :keyword service_runtime_subnet_id: Fully qualified resource Id of the subnet to host Azure + Spring Cloud Service Runtime. + :paramtype service_runtime_subnet_id: str + :keyword app_subnet_id: Fully qualified resource Id of the subnet to host Azure Spring Cloud + Apps. + :paramtype app_subnet_id: str + :keyword service_cidr: Azure Spring Cloud service reserved CIDR. + :paramtype service_cidr: str + :keyword service_runtime_network_resource_group: Name of the resource group containing network + resources of Azure Spring Cloud Service Runtime. + :paramtype service_runtime_network_resource_group: str + :keyword app_network_resource_group: Name of the resource group containing network resources of + Azure Spring Cloud Apps. + :paramtype app_network_resource_group: str + """ 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) @@ -1644,6 +2014,8 @@ def __init__( self, **kwargs ): + """ + """ super(NetworkProfileOutboundIPs, self).__init__(**kwargs) self.public_i_ps = None @@ -1651,22 +2023,32 @@ def __init__( class OperationDetail(msrest.serialization.Model): """Operation detail payload. - :param name: Name of the operation. - :type name: str - :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. - :type origin: str - :param properties: Properties of the operation. - :type properties: ~azure.mgmt.appplatform.v2020_11_01_preview.models.OperationProperties + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar name: Name of the operation. + :vartype name: str + :ivar is_data_action: Indicates whether the operation is a data action. + :vartype is_data_action: bool + :ivar display: Display of the operation. + :vartype display: ~azure.mgmt.appplatform.v2020_11_01_preview.models.OperationDisplay + :ivar action_type: Enum. Indicates the action type. "Internal" refers to actions that are for + internal only APIs. Possible values include: "Internal". + :vartype action_type: str or ~azure.mgmt.appplatform.v2020_11_01_preview.models.ActionType + :ivar origin: Origin of the operation. + :vartype origin: str + :ivar properties: Properties of the operation. + :vartype properties: ~azure.mgmt.appplatform.v2020_11_01_preview.models.OperationProperties """ + _validation = { + 'action_type': {'readonly': True}, + } + _attribute_map = { 'name': {'key': 'name', 'type': 'str'}, 'is_data_action': {'key': 'isDataAction', 'type': 'bool'}, 'display': {'key': 'display', 'type': 'OperationDisplay'}, + 'action_type': {'key': 'actionType', 'type': 'str'}, 'origin': {'key': 'origin', 'type': 'str'}, 'properties': {'key': 'properties', 'type': 'OperationProperties'}, } @@ -1675,10 +2057,23 @@ def __init__( self, **kwargs ): + """ + :keyword name: Name of the operation. + :paramtype name: str + :keyword is_data_action: Indicates whether the operation is a data action. + :paramtype is_data_action: bool + :keyword display: Display of the operation. + :paramtype display: ~azure.mgmt.appplatform.v2020_11_01_preview.models.OperationDisplay + :keyword origin: Origin of the operation. + :paramtype origin: str + :keyword properties: Properties of the operation. + :paramtype properties: ~azure.mgmt.appplatform.v2020_11_01_preview.models.OperationProperties + """ super(OperationDetail, self).__init__(**kwargs) self.name = kwargs.get('name', None) self.is_data_action = kwargs.get('is_data_action', None) self.display = kwargs.get('display', None) + self.action_type = None self.origin = kwargs.get('origin', None) self.properties = kwargs.get('properties', None) @@ -1686,14 +2081,14 @@ def __init__( class OperationDisplay(msrest.serialization.Model): """Operation display payload. - :param provider: Resource provider of the operation. - :type provider: str - :param resource: Resource of the operation. - :type resource: str - :param operation: Localized friendly name for the operation. - :type operation: str - :param description: Localized friendly description for the operation. - :type description: str + :ivar provider: Resource provider of the operation. + :vartype provider: str + :ivar resource: Resource of the operation. + :vartype resource: str + :ivar operation: Localized friendly name for the operation. + :vartype operation: str + :ivar description: Localized friendly description for the operation. + :vartype description: str """ _attribute_map = { @@ -1707,6 +2102,16 @@ def __init__( self, **kwargs ): + """ + :keyword provider: Resource provider of the operation. + :paramtype provider: str + :keyword resource: Resource of the operation. + :paramtype resource: str + :keyword operation: Localized friendly name for the operation. + :paramtype operation: str + :keyword description: Localized friendly description for the operation. + :paramtype description: str + """ super(OperationDisplay, self).__init__(**kwargs) self.provider = kwargs.get('provider', None) self.resource = kwargs.get('resource', None) @@ -1717,8 +2122,8 @@ def __init__( class OperationProperties(msrest.serialization.Model): """Extra Operation properties. - :param service_specification: Service specifications of the operation. - :type service_specification: + :ivar service_specification: Service specifications of the operation. + :vartype service_specification: ~azure.mgmt.appplatform.v2020_11_01_preview.models.ServiceSpecification """ @@ -1730,6 +2135,11 @@ def __init__( self, **kwargs ): + """ + :keyword service_specification: Service specifications of the operation. + :paramtype service_specification: + ~azure.mgmt.appplatform.v2020_11_01_preview.models.ServiceSpecification + """ super(OperationProperties, self).__init__(**kwargs) self.service_specification = kwargs.get('service_specification', None) @@ -1739,12 +2149,12 @@ class PersistentDisk(msrest.serialization.Model): 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. - :type size_in_gb: int + :ivar size_in_gb: Size of the persistent disk in GB. + :vartype size_in_gb: int :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. - :type mount_path: str + :ivar mount_path: Mount path of the persistent disk. + :vartype mount_path: str """ _validation = { @@ -1762,6 +2172,12 @@ def __init__( self, **kwargs ): + """ + :keyword size_in_gb: Size of the persistent disk in GB. + :paramtype size_in_gb: int + :keyword mount_path: Mount path of the persistent disk. + :paramtype mount_path: str + """ super(PersistentDisk, self).__init__(**kwargs) self.size_in_gb = kwargs.get('size_in_gb', None) self.used_in_gb = None @@ -1773,9 +2189,9 @@ class RegenerateTestKeyRequestPayload(msrest.serialization.Model): 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", + :ivar 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 + :vartype key_type: str or ~azure.mgmt.appplatform.v2020_11_01_preview.models.TestKeyType """ _validation = { @@ -1790,6 +2206,11 @@ def __init__( self, **kwargs ): + """ + :keyword key_type: Required. Type of the test key. Possible values include: "Primary", + "Secondary". + :paramtype key_type: str or ~azure.mgmt.appplatform.v2020_11_01_preview.models.TestKeyType + """ super(RegenerateTestKeyRequestPayload, self).__init__(**kwargs) self.key_type = kwargs['key_type'] @@ -1832,6 +2253,8 @@ def __init__( self, **kwargs ): + """ + """ super(RequiredTraffic, self).__init__(**kwargs) self.protocol = None self.port = None @@ -1843,23 +2266,23 @@ def __init__( class ResourceSku(msrest.serialization.Model): """Describes an available Azure Spring Cloud SKU. - :param resource_type: Gets the type of resource the SKU applies to. - :type resource_type: str - :param name: Gets the name of SKU. - :type name: str - :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 - :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 + :ivar resource_type: Gets the type of resource the SKU applies to. + :vartype resource_type: str + :ivar name: Gets the name of SKU. + :vartype name: str + :ivar tier: Gets the tier of SKU. + :vartype tier: str + :ivar capacity: Gets the capacity of SKU. + :vartype capacity: ~azure.mgmt.appplatform.v2020_11_01_preview.models.SkuCapacity + :ivar locations: Gets the set of locations that the SKU is available. + :vartype locations: list[str] + :ivar location_info: Gets a list of locations and availability zones in those locations where the SKU is available. - :type location_info: + :vartype 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 + :ivar restrictions: Gets the restrictions because of which SKU cannot be used. This is empty if there are no restrictions. - :type restrictions: + :vartype restrictions: list[~azure.mgmt.appplatform.v2020_11_01_preview.models.ResourceSkuRestrictions] """ @@ -1877,6 +2300,26 @@ def __init__( self, **kwargs ): + """ + :keyword resource_type: Gets the type of resource the SKU applies to. + :paramtype resource_type: str + :keyword name: Gets the name of SKU. + :paramtype name: str + :keyword tier: Gets the tier of SKU. + :paramtype tier: str + :keyword capacity: Gets the capacity of SKU. + :paramtype capacity: ~azure.mgmt.appplatform.v2020_11_01_preview.models.SkuCapacity + :keyword locations: Gets the set of locations that the SKU is available. + :paramtype locations: list[str] + :keyword location_info: Gets a list of locations and availability zones in those locations + where the SKU is available. + :paramtype location_info: + list[~azure.mgmt.appplatform.v2020_11_01_preview.models.ResourceSkuLocationInfo] + :keyword restrictions: Gets the restrictions because of which SKU cannot be used. This is + empty if there are no restrictions. + :paramtype restrictions: + list[~azure.mgmt.appplatform.v2020_11_01_preview.models.ResourceSkuRestrictions] + """ super(ResourceSku, self).__init__(**kwargs) self.resource_type = kwargs.get('resource_type', None) self.name = kwargs.get('name', None) @@ -1890,10 +2333,10 @@ def __init__( class ResourceSkuCapabilities(msrest.serialization.Model): """ResourceSkuCapabilities. - :param name: Gets an invariant to describe the feature. - :type name: str - :param value: Gets an invariant if the feature is measured by quantity. - :type value: str + :ivar name: Gets an invariant to describe the feature. + :vartype name: str + :ivar value: Gets an invariant if the feature is measured by quantity. + :vartype value: str """ _attribute_map = { @@ -1905,6 +2348,12 @@ def __init__( self, **kwargs ): + """ + :keyword name: Gets an invariant to describe the feature. + :paramtype name: str + :keyword value: Gets an invariant if the feature is measured by quantity. + :paramtype value: str + """ super(ResourceSkuCapabilities, self).__init__(**kwargs) self.name = kwargs.get('name', None) self.value = kwargs.get('value', None) @@ -1913,11 +2362,11 @@ def __init__( 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). + :ivar value: Collection of resource SKU. + :vartype value: list[~azure.mgmt.appplatform.v2020_11_01_preview.models.ResourceSku] + :ivar 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 + :vartype next_link: str """ _attribute_map = { @@ -1929,6 +2378,13 @@ def __init__( self, **kwargs ): + """ + :keyword value: Collection of resource SKU. + :paramtype value: list[~azure.mgmt.appplatform.v2020_11_01_preview.models.ResourceSku] + :keyword next_link: URL client should use to fetch the next page (per server side paging). + It's null for now, added for future use. + :paramtype next_link: str + """ super(ResourceSkuCollection, self).__init__(**kwargs) self.value = kwargs.get('value', None) self.next_link = kwargs.get('next_link', None) @@ -1937,12 +2393,12 @@ def __init__( class ResourceSkuLocationInfo(msrest.serialization.Model): """Locations and availability zones where the SKU is available. - :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: + :ivar location: Gets location of the SKU. + :vartype location: str + :ivar zones: Gets list of availability zones where the SKU is supported. + :vartype zones: list[str] + :ivar zone_details: Gets details of capabilities available to a SKU in specific zones. + :vartype zone_details: list[~azure.mgmt.appplatform.v2020_11_01_preview.models.ResourceSkuZoneDetails] """ @@ -1956,6 +2412,15 @@ def __init__( self, **kwargs ): + """ + :keyword location: Gets location of the SKU. + :paramtype location: str + :keyword zones: Gets list of availability zones where the SKU is supported. + :paramtype zones: list[str] + :keyword zone_details: Gets details of capabilities available to a SKU in specific zones. + :paramtype zone_details: + list[~azure.mgmt.appplatform.v2020_11_01_preview.models.ResourceSkuZoneDetails] + """ super(ResourceSkuLocationInfo, self).__init__(**kwargs) self.location = kwargs.get('location', None) self.zones = kwargs.get('zones', None) @@ -1965,10 +2430,10 @@ def __init__( class ResourceSkuRestrictionInfo(msrest.serialization.Model): """Information about the restriction where the SKU cannot be used. - :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] + :ivar locations: Gets locations where the SKU is restricted. + :vartype locations: list[str] + :ivar zones: Gets list of availability zones where the SKU is restricted. + :vartype zones: list[str] """ _attribute_map = { @@ -1980,6 +2445,12 @@ def __init__( self, **kwargs ): + """ + :keyword locations: Gets locations where the SKU is restricted. + :paramtype locations: list[str] + :keyword zones: Gets list of availability zones where the SKU is restricted. + :paramtype zones: list[str] + """ super(ResourceSkuRestrictionInfo, self).__init__(**kwargs) self.locations = kwargs.get('locations', None) self.zones = kwargs.get('zones', None) @@ -1988,21 +2459,21 @@ def __init__( class ResourceSkuRestrictions(msrest.serialization.Model): """Restrictions where the SKU cannot be used. - :param type: Gets the type of restrictions. Possible values include: 'Location', 'Zone'. + :ivar type: Gets the type of restrictions. Possible values include: 'Location', 'Zone'. Possible values include: "Location", "Zone". - :type type: str or + :vartype 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 + :ivar 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 + :vartype values: list[str] + :ivar restriction_info: Gets the information about the restriction where the SKU cannot be used. - :type restriction_info: + :vartype restriction_info: ~azure.mgmt.appplatform.v2020_11_01_preview.models.ResourceSkuRestrictionInfo - :param reason_code: Gets the reason for restriction. Possible values include: 'QuotaId', + :ivar reason_code: Gets the reason for restriction. Possible values include: 'QuotaId', 'NotAvailableForSubscription'. Possible values include: "QuotaId", "NotAvailableForSubscription". - :type reason_code: str or + :vartype reason_code: str or ~azure.mgmt.appplatform.v2020_11_01_preview.models.ResourceSkuRestrictionsReasonCode """ @@ -2017,6 +2488,24 @@ def __init__( self, **kwargs ): + """ + :keyword type: Gets the type of restrictions. Possible values include: 'Location', 'Zone'. + Possible values include: "Location", "Zone". + :paramtype type: str or + ~azure.mgmt.appplatform.v2020_11_01_preview.models.ResourceSkuRestrictionsType + :keyword values: Gets the value of restrictions. If the restriction type is set to + location. This would be different locations where the SKU is restricted. + :paramtype values: list[str] + :keyword restriction_info: Gets the information about the restriction where the SKU cannot be + used. + :paramtype restriction_info: + ~azure.mgmt.appplatform.v2020_11_01_preview.models.ResourceSkuRestrictionInfo + :keyword reason_code: Gets the reason for restriction. Possible values include: 'QuotaId', + 'NotAvailableForSubscription'. Possible values include: "QuotaId", + "NotAvailableForSubscription". + :paramtype reason_code: str or + ~azure.mgmt.appplatform.v2020_11_01_preview.models.ResourceSkuRestrictionsReasonCode + """ super(ResourceSkuRestrictions, self).__init__(**kwargs) self.type = kwargs.get('type', None) self.values = kwargs.get('values', None) @@ -2027,12 +2516,12 @@ def __init__( 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 + :ivar 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 + :vartype name: list[str] + :ivar capabilities: Gets a list of capabilities that are available for the SKU in the specified list of zones. - :type capabilities: + :vartype capabilities: list[~azure.mgmt.appplatform.v2020_11_01_preview.models.ResourceSkuCapabilities] """ @@ -2045,6 +2534,15 @@ def __init__( self, **kwargs ): + """ + :keyword name: Gets the set of zones that the SKU is available in with the + specified capabilities. + :paramtype name: list[str] + :keyword capabilities: Gets a list of capabilities that are available for the SKU in the + specified list of zones. + :paramtype capabilities: + list[~azure.mgmt.appplatform.v2020_11_01_preview.models.ResourceSkuCapabilities] + """ super(ResourceSkuZoneDetails, self).__init__(**kwargs) self.name = kwargs.get('name', None) self.capabilities = kwargs.get('capabilities', None) @@ -2053,10 +2551,10 @@ def __init__( class ResourceUploadDefinition(msrest.serialization.Model): """Resource upload definition payload. - :param relative_path: Source relative path. - :type relative_path: str - :param upload_url: Upload URL. - :type upload_url: str + :ivar relative_path: Source relative path. + :vartype relative_path: str + :ivar upload_url: Upload URL. + :vartype upload_url: str """ _attribute_map = { @@ -2068,6 +2566,12 @@ def __init__( self, **kwargs ): + """ + :keyword relative_path: Source relative path. + :paramtype relative_path: str + :keyword upload_url: Upload URL. + :paramtype upload_url: str + """ super(ResourceUploadDefinition, self).__init__(**kwargs) self.relative_path = kwargs.get('relative_path', None) self.upload_url = kwargs.get('upload_url', None) @@ -2084,11 +2588,11 @@ class TrackedResource(Resource): :vartype name: str :ivar type: The type of the resource. :vartype type: str - :param location: The GEO location of the resource. - :type location: str - :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] + :ivar location: The GEO location of the resource. + :vartype location: str + :ivar tags: A set of tags. Tags of the service which is a list of key value pairs that describe + the resource. + :vartype tags: dict[str, str] """ _validation = { @@ -2109,6 +2613,13 @@ def __init__( self, **kwargs ): + """ + :keyword location: The GEO location of the resource. + :paramtype location: str + :keyword tags: A set of tags. Tags of the service which is a list of key value pairs that + describe the resource. + :paramtype tags: dict[str, str] + """ super(TrackedResource, self).__init__(**kwargs) self.location = kwargs.get('location', None) self.tags = kwargs.get('tags', None) @@ -2125,15 +2636,16 @@ class ServiceResource(TrackedResource): :vartype name: str :ivar type: The type of the resource. :vartype type: str - :param location: The GEO location of the resource. - :type location: str - :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. - :type sku: ~azure.mgmt.appplatform.v2020_11_01_preview.models.Sku + :ivar location: The GEO location of the resource. + :vartype location: str + :ivar tags: A set of tags. Tags of the service which is a list of key value pairs that describe + the resource. + :vartype tags: dict[str, str] + :ivar properties: Properties of the Service resource. + :vartype properties: + ~azure.mgmt.appplatform.v2020_11_01_preview.models.ClusterResourceProperties + :ivar sku: Sku of the Service resource. + :vartype sku: ~azure.mgmt.appplatform.v2020_11_01_preview.models.Sku """ _validation = { @@ -2156,6 +2668,18 @@ def __init__( self, **kwargs ): + """ + :keyword location: The GEO location of the resource. + :paramtype location: str + :keyword tags: A set of tags. Tags of the service which is a list of key value pairs that + describe the resource. + :paramtype tags: dict[str, str] + :keyword properties: Properties of the Service resource. + :paramtype properties: + ~azure.mgmt.appplatform.v2020_11_01_preview.models.ClusterResourceProperties + :keyword sku: Sku of the Service resource. + :paramtype sku: ~azure.mgmt.appplatform.v2020_11_01_preview.models.Sku + """ super(ServiceResource, self).__init__(**kwargs) self.properties = kwargs.get('properties', None) self.sku = kwargs.get('sku', None) @@ -2164,11 +2688,11 @@ def __init__( 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). + :ivar value: Collection of Service resources. + :vartype value: list[~azure.mgmt.appplatform.v2020_11_01_preview.models.ServiceResource] + :ivar 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 + :vartype next_link: str """ _attribute_map = { @@ -2180,6 +2704,13 @@ def __init__( self, **kwargs ): + """ + :keyword value: Collection of Service resources. + :paramtype value: list[~azure.mgmt.appplatform.v2020_11_01_preview.models.ServiceResource] + :keyword next_link: URL client should use to fetch the next page (per server side paging). + It's null for now, added for future use. + :paramtype next_link: str + """ super(ServiceResourceList, self).__init__(**kwargs) self.value = kwargs.get('value', None) self.next_link = kwargs.get('next_link', None) @@ -2188,11 +2719,11 @@ def __init__( class ServiceSpecification(msrest.serialization.Model): """Service specification payload. - :param log_specifications: Specifications of the Log for Azure Monitoring. - :type log_specifications: + :ivar log_specifications: Specifications of the Log for Azure Monitoring. + :vartype log_specifications: list[~azure.mgmt.appplatform.v2020_11_01_preview.models.LogSpecification] - :param metric_specifications: Specifications of the Metrics for Azure Monitoring. - :type metric_specifications: + :ivar metric_specifications: Specifications of the Metrics for Azure Monitoring. + :vartype metric_specifications: list[~azure.mgmt.appplatform.v2020_11_01_preview.models.MetricSpecification] """ @@ -2205,6 +2736,14 @@ def __init__( self, **kwargs ): + """ + :keyword log_specifications: Specifications of the Log for Azure Monitoring. + :paramtype log_specifications: + list[~azure.mgmt.appplatform.v2020_11_01_preview.models.LogSpecification] + :keyword metric_specifications: Specifications of the Metrics for Azure Monitoring. + :paramtype metric_specifications: + list[~azure.mgmt.appplatform.v2020_11_01_preview.models.MetricSpecification] + """ super(ServiceSpecification, self).__init__(**kwargs) self.log_specifications = kwargs.get('log_specifications', None) self.metric_specifications = kwargs.get('metric_specifications', None) @@ -2213,12 +2752,12 @@ def __init__( class Sku(msrest.serialization.Model): """Sku of Azure Spring Cloud. - :param name: Name of the Sku. - :type name: str - :param tier: Tier of the Sku. - :type tier: str - :param capacity: Current capacity of the target resource. - :type capacity: int + :ivar name: Name of the Sku. + :vartype name: str + :ivar tier: Tier of the Sku. + :vartype tier: str + :ivar capacity: Current capacity of the target resource. + :vartype capacity: int """ _attribute_map = { @@ -2231,6 +2770,14 @@ def __init__( self, **kwargs ): + """ + :keyword name: Name of the Sku. + :paramtype name: str + :keyword tier: Tier of the Sku. + :paramtype tier: str + :keyword capacity: Current capacity of the target resource. + :paramtype capacity: int + """ super(Sku, self).__init__(**kwargs) self.name = kwargs.get('name', "S0") self.tier = kwargs.get('tier', "Standard") @@ -2242,15 +2789,15 @@ class SkuCapacity(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param minimum: Required. Gets or sets the minimum. - :type minimum: int - :param maximum: Gets or sets the maximum. - :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", + :ivar minimum: Required. Gets or sets the minimum. + :vartype minimum: int + :ivar maximum: Gets or sets the maximum. + :vartype maximum: int + :ivar default: Gets or sets the default. + :vartype default: int + :ivar 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 + :vartype scale_type: str or ~azure.mgmt.appplatform.v2020_11_01_preview.models.SkuScaleType """ _validation = { @@ -2268,6 +2815,17 @@ def __init__( self, **kwargs ): + """ + :keyword minimum: Required. Gets or sets the minimum. + :paramtype minimum: int + :keyword maximum: Gets or sets the maximum. + :paramtype maximum: int + :keyword default: Gets or sets the default. + :paramtype default: int + :keyword scale_type: Gets or sets the type of the scale. Possible values include: "None", + "Manual", "Automatic". + :paramtype scale_type: str or ~azure.mgmt.appplatform.v2020_11_01_preview.models.SkuScaleType + """ super(SkuCapacity, self).__init__(**kwargs) self.minimum = kwargs['minimum'] self.maximum = kwargs.get('maximum', None) @@ -2278,15 +2836,15 @@ def __init__( 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"). + :ivar value: The raw value which could be passed to deployment CRUD operations. Possible values + include: "Java_8", "Java_11", "NetCore_31". + :vartype value: str or ~azure.mgmt.appplatform.v2020_11_01_preview.models.SupportedRuntimeValue + :ivar platform: The platform of this runtime version (possible values: "Java" or ".NET"). Possible values include: "Java", ".NET Core". - :type platform: str or + :vartype platform: str or ~azure.mgmt.appplatform.v2020_11_01_preview.models.SupportedRuntimePlatform - :param version: The detailed version (major.minor) of the platform. - :type version: str + :ivar version: The detailed version (major.minor) of the platform. + :vartype version: str """ _attribute_map = { @@ -2299,6 +2857,18 @@ def __init__( self, **kwargs ): + """ + :keyword value: The raw value which could be passed to deployment CRUD operations. Possible + values include: "Java_8", "Java_11", "NetCore_31". + :paramtype value: str or + ~azure.mgmt.appplatform.v2020_11_01_preview.models.SupportedRuntimeValue + :keyword platform: The platform of this runtime version (possible values: "Java" or ".NET"). + Possible values include: "Java", ".NET Core". + :paramtype platform: str or + ~azure.mgmt.appplatform.v2020_11_01_preview.models.SupportedRuntimePlatform + :keyword version: The detailed version (major.minor) of the platform. + :paramtype version: str + """ super(SupportedRuntimeVersion, self).__init__(**kwargs) self.value = kwargs.get('value', None) self.platform = kwargs.get('platform', None) @@ -2308,10 +2878,10 @@ def __init__( class TemporaryDisk(msrest.serialization.Model): """Temporary disk payload. - :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. - :type mount_path: str + :ivar size_in_gb: Size of the temporary disk in GB. + :vartype size_in_gb: int + :ivar mount_path: Mount path of the temporary disk. + :vartype mount_path: str """ _validation = { @@ -2327,6 +2897,12 @@ def __init__( self, **kwargs ): + """ + :keyword size_in_gb: Size of the temporary disk in GB. + :paramtype size_in_gb: int + :keyword mount_path: Mount path of the temporary disk. + :paramtype mount_path: str + """ super(TemporaryDisk, self).__init__(**kwargs) self.size_in_gb = kwargs.get('size_in_gb', None) self.mount_path = kwargs.get('mount_path', "/tmp") @@ -2335,16 +2911,16 @@ def __init__( class TestKeys(msrest.serialization.Model): """Test keys payload. - :param primary_key: Primary key. - :type primary_key: str - :param secondary_key: Secondary key. - :type secondary_key: str - :param primary_test_endpoint: Primary test endpoint. - :type primary_test_endpoint: str - :param secondary_test_endpoint: Secondary test endpoint. - :type secondary_test_endpoint: str - :param enabled: Indicates whether the test endpoint feature enabled or not. - :type enabled: bool + :ivar primary_key: Primary key. + :vartype primary_key: str + :ivar secondary_key: Secondary key. + :vartype secondary_key: str + :ivar primary_test_endpoint: Primary test endpoint. + :vartype primary_test_endpoint: str + :ivar secondary_test_endpoint: Secondary test endpoint. + :vartype secondary_test_endpoint: str + :ivar enabled: Indicates whether the test endpoint feature enabled or not. + :vartype enabled: bool """ _attribute_map = { @@ -2359,6 +2935,18 @@ def __init__( self, **kwargs ): + """ + :keyword primary_key: Primary key. + :paramtype primary_key: str + :keyword secondary_key: Secondary key. + :paramtype secondary_key: str + :keyword primary_test_endpoint: Primary test endpoint. + :paramtype primary_test_endpoint: str + :keyword secondary_test_endpoint: Secondary test endpoint. + :paramtype secondary_test_endpoint: str + :keyword enabled: Indicates whether the test endpoint feature enabled or not. + :paramtype enabled: bool + """ super(TestKeys, self).__init__(**kwargs) self.primary_key = kwargs.get('primary_key', None) self.secondary_key = kwargs.get('secondary_key', None) @@ -2370,17 +2958,17 @@ def __init__( class UserSourceInfo(msrest.serialization.Model): """Source information for a deployment. - :param type: Type of the source uploaded. Possible values include: "Jar", "NetCoreZip", + :ivar 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. - :type version: str - :param artifact_selector: Selector for the artifact to be used for the deployment for + :vartype type: str or ~azure.mgmt.appplatform.v2020_11_01_preview.models.UserSourceType + :ivar relative_path: Relative path of the storage which stores the source. + :vartype relative_path: str + :ivar version: Version of the source. + :vartype version: str + :ivar 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 + :vartype artifact_selector: str """ _attribute_map = { @@ -2394,6 +2982,19 @@ def __init__( self, **kwargs ): + """ + :keyword type: Type of the source uploaded. Possible values include: "Jar", "NetCoreZip", + "Source". + :paramtype type: str or ~azure.mgmt.appplatform.v2020_11_01_preview.models.UserSourceType + :keyword relative_path: Relative path of the storage which stores the source. + :paramtype relative_path: str + :keyword version: Version of the source. + :paramtype version: str + :keyword 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. + :paramtype artifact_selector: str + """ super(UserSourceInfo, self).__init__(**kwargs) self.type = kwargs.get('type', None) self.relative_path = kwargs.get('relative_path', None) diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2020_11_01_preview/models/_models_py3.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2020_11_01_preview/models/_models_py3.py index ad133e58850ca..b933174dc5630 100644 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2020_11_01_preview/models/_models_py3.py +++ b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2020_11_01_preview/models/_models_py3.py @@ -34,6 +34,8 @@ def __init__( self, **kwargs ): + """ + """ super(ApplicationInsightsAgentVersions, self).__init__(**kwargs) self.java = None @@ -67,6 +69,8 @@ def __init__( self, **kwargs ): + """ + """ super(Resource, self).__init__(**kwargs) self.id = None self.name = None @@ -102,6 +106,8 @@ def __init__( self, **kwargs ): + """ + """ super(ProxyResource, self).__init__(**kwargs) @@ -116,12 +122,12 @@ 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. - :type location: str + :ivar properties: Properties of the App resource. + :vartype properties: ~azure.mgmt.appplatform.v2020_11_01_preview.models.AppResourceProperties + :ivar identity: The Managed Identity type of the app resource. + :vartype identity: ~azure.mgmt.appplatform.v2020_11_01_preview.models.ManagedIdentityProperties + :ivar location: The GEO location of the application, always the same with its parent resource. + :vartype location: str """ _validation = { @@ -147,6 +153,16 @@ def __init__( location: Optional[str] = None, **kwargs ): + """ + :keyword properties: Properties of the App resource. + :paramtype properties: ~azure.mgmt.appplatform.v2020_11_01_preview.models.AppResourceProperties + :keyword identity: The Managed Identity type of the app resource. + :paramtype identity: + ~azure.mgmt.appplatform.v2020_11_01_preview.models.ManagedIdentityProperties + :keyword location: The GEO location of the application, always the same with its parent + resource. + :paramtype location: str + """ super(AppResource, self).__init__(**kwargs) self.properties = properties self.identity = identity @@ -156,11 +172,11 @@ def __init__( 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). + :ivar value: Collection of App resources. + :vartype value: list[~azure.mgmt.appplatform.v2020_11_01_preview.models.AppResource] + :ivar 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 + :vartype next_link: str """ _attribute_map = { @@ -175,6 +191,13 @@ def __init__( next_link: Optional[str] = None, **kwargs ): + """ + :keyword value: Collection of App resources. + :paramtype value: list[~azure.mgmt.appplatform.v2020_11_01_preview.models.AppResource] + :keyword next_link: URL client should use to fetch the next page (per server side paging). + It's null for now, added for future use. + :paramtype next_link: str + """ super(AppResourceCollection, self).__init__(**kwargs) self.value = value self.next_link = next_link @@ -185,28 +208,28 @@ class AppResourceProperties(msrest.serialization.Model): Variables are only populated by the server, and will be ignored when sending a request. - :param public: Indicates whether the App exposes public endpoint. - :type public: bool + :ivar public: Indicates whether the App exposes public endpoint. + :vartype public: bool :ivar url: URL of the App. :vartype url: str :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. - :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 active_deployment_name: Name of the active deployment of the App. + :vartype active_deployment_name: str + :ivar fqdn: Fully qualified dns Name. + :vartype fqdn: str + :ivar https_only: Indicate if only https is allowed. + :vartype https_only: bool :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 + :ivar temporary_disk: Temporary disk settings. + :vartype temporary_disk: ~azure.mgmt.appplatform.v2020_11_01_preview.models.TemporaryDisk + :ivar persistent_disk: Persistent disk settings. + :vartype persistent_disk: ~azure.mgmt.appplatform.v2020_11_01_preview.models.PersistentDisk + :ivar enable_end_to_end_tls: Indicate if end to end TLS is enabled. + :vartype enable_end_to_end_tls: bool """ _validation = { @@ -240,6 +263,22 @@ def __init__( enable_end_to_end_tls: Optional[bool] = False, **kwargs ): + """ + :keyword public: Indicates whether the App exposes public endpoint. + :paramtype public: bool + :keyword active_deployment_name: Name of the active deployment of the App. + :paramtype active_deployment_name: str + :keyword fqdn: Fully qualified dns Name. + :paramtype fqdn: str + :keyword https_only: Indicate if only https is allowed. + :paramtype https_only: bool + :keyword temporary_disk: Temporary disk settings. + :paramtype temporary_disk: ~azure.mgmt.appplatform.v2020_11_01_preview.models.TemporaryDisk + :keyword persistent_disk: Persistent disk settings. + :paramtype persistent_disk: ~azure.mgmt.appplatform.v2020_11_01_preview.models.PersistentDisk + :keyword enable_end_to_end_tls: Indicate if end to end TLS is enabled. + :paramtype enable_end_to_end_tls: bool + """ super(AppResourceProperties, self).__init__(**kwargs) self.public = public self.url = None @@ -256,11 +295,11 @@ def __init__( 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). + :ivar value: Collection of available operation details. + :vartype value: list[~azure.mgmt.appplatform.v2020_11_01_preview.models.OperationDetail] + :ivar 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 + :vartype next_link: str """ _attribute_map = { @@ -275,6 +314,13 @@ def __init__( next_link: Optional[str] = None, **kwargs ): + """ + :keyword value: Collection of available operation details. + :paramtype value: list[~azure.mgmt.appplatform.v2020_11_01_preview.models.OperationDetail] + :keyword next_link: URL client should use to fetch the next page (per server side paging). + It's null for now, added for future use. + :paramtype next_link: str + """ super(AvailableOperations, self).__init__(**kwargs) self.value = value self.next_link = next_link @@ -302,6 +348,8 @@ def __init__( self, **kwargs ): + """ + """ super(AvailableRuntimeVersions, self).__init__(**kwargs) self.value = None @@ -317,8 +365,9 @@ 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 + :ivar properties: Properties of the Binding resource. + :vartype properties: + ~azure.mgmt.appplatform.v2020_11_01_preview.models.BindingResourceProperties """ _validation = { @@ -340,6 +389,11 @@ def __init__( properties: Optional["BindingResourceProperties"] = None, **kwargs ): + """ + :keyword properties: Properties of the Binding resource. + :paramtype properties: + ~azure.mgmt.appplatform.v2020_11_01_preview.models.BindingResourceProperties + """ super(BindingResource, self).__init__(**kwargs) self.properties = properties @@ -347,11 +401,11 @@ def __init__( 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). + :ivar value: Collection of Binding resources. + :vartype value: list[~azure.mgmt.appplatform.v2020_11_01_preview.models.BindingResource] + :ivar 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 + :vartype next_link: str """ _attribute_map = { @@ -366,6 +420,13 @@ def __init__( next_link: Optional[str] = None, **kwargs ): + """ + :keyword value: Collection of Binding resources. + :paramtype value: list[~azure.mgmt.appplatform.v2020_11_01_preview.models.BindingResource] + :keyword next_link: URL client should use to fetch the next page (per server side paging). + It's null for now, added for future use. + :paramtype next_link: str + """ super(BindingResourceCollection, self).__init__(**kwargs) self.value = value self.next_link = next_link @@ -380,12 +441,12 @@ class BindingResourceProperties(msrest.serialization.Model): :vartype resource_name: str :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. - :type resource_id: str - :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, any] + :ivar resource_id: The Azure resource id of the bound resource. + :vartype resource_id: str + :ivar key: The key of the bound resource. + :vartype key: str + :ivar binding_parameters: Binding parameters of the Binding resource. + :vartype 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 @@ -422,6 +483,14 @@ def __init__( binding_parameters: Optional[Dict[str, Any]] = None, **kwargs ): + """ + :keyword resource_id: The Azure resource id of the bound resource. + :paramtype resource_id: str + :keyword key: The key of the bound resource. + :paramtype key: str + :keyword binding_parameters: Binding parameters of the Binding resource. + :paramtype binding_parameters: dict[str, any] + """ super(BindingResourceProperties, self).__init__(**kwargs) self.resource_name = None self.resource_type = None @@ -442,12 +511,12 @@ class CertificateProperties(msrest.serialization.Model): :ivar thumbprint: The thumbprint of certificate. :vartype thumbprint: str - :param vault_uri: Required. The vault uri of user key vault. - :type vault_uri: str - :param key_vault_cert_name: Required. The certificate name of key vault. - :type key_vault_cert_name: str - :param cert_version: The certificate version of key vault. - :type cert_version: str + :ivar vault_uri: Required. The vault uri of user key vault. + :vartype vault_uri: str + :ivar key_vault_cert_name: Required. The certificate name of key vault. + :vartype key_vault_cert_name: str + :ivar cert_version: The certificate version of key vault. + :vartype cert_version: str :ivar issuer: The issuer of certificate. :vartype issuer: str :ivar issued_date: The issue date of certificate. @@ -495,6 +564,14 @@ def __init__( cert_version: Optional[str] = None, **kwargs ): + """ + :keyword vault_uri: Required. The vault uri of user key vault. + :paramtype vault_uri: str + :keyword key_vault_cert_name: Required. The certificate name of key vault. + :paramtype key_vault_cert_name: str + :keyword cert_version: The certificate version of key vault. + :paramtype cert_version: str + """ super(CertificateProperties, self).__init__(**kwargs) self.thumbprint = None self.vault_uri = vault_uri @@ -519,8 +596,8 @@ class CertificateResource(ProxyResource): :vartype name: str :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 + :ivar properties: Properties of the certificate resource payload. + :vartype properties: ~azure.mgmt.appplatform.v2020_11_01_preview.models.CertificateProperties """ _validation = { @@ -542,6 +619,10 @@ def __init__( properties: Optional["CertificateProperties"] = None, **kwargs ): + """ + :keyword properties: Properties of the certificate resource payload. + :paramtype properties: ~azure.mgmt.appplatform.v2020_11_01_preview.models.CertificateProperties + """ super(CertificateResource, self).__init__(**kwargs) self.properties = properties @@ -549,10 +630,10 @@ def __init__( class CertificateResourceCollection(msrest.serialization.Model): """Collection compose of certificate resources list and a possible link for next page. - :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 + :ivar value: The certificate resources list. + :vartype value: list[~azure.mgmt.appplatform.v2020_11_01_preview.models.CertificateResource] + :ivar next_link: The link to next page of certificate list. + :vartype next_link: str """ _attribute_map = { @@ -567,6 +648,12 @@ def __init__( next_link: Optional[str] = None, **kwargs ): + """ + :keyword value: The certificate resources list. + :paramtype value: list[~azure.mgmt.appplatform.v2020_11_01_preview.models.CertificateResource] + :keyword next_link: The link to next page of certificate list. + :paramtype next_link: str + """ super(CertificateResourceCollection, self).__init__(**kwargs) self.value = value self.next_link = next_link @@ -575,17 +662,17 @@ def __init__( 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 + :ivar 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 + :vartype code: str + :ivar 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 + :vartype message: str + :ivar 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] + :vartype target: str + :ivar details: A list of additional details about the error. + :vartype details: list[~azure.mgmt.appplatform.v2020_11_01_preview.models.CloudErrorBody] """ _attribute_map = { @@ -604,6 +691,19 @@ def __init__( details: Optional[List["CloudErrorBody"]] = None, **kwargs ): + """ + :keyword code: An identifier for the error. Codes are invariant and are intended to be consumed + programmatically. + :paramtype code: str + :keyword message: A message describing the error, intended to be suitable for display in a user + interface. + :paramtype message: str + :keyword target: The target of the particular error. For example, the name of the property in + error. + :paramtype target: str + :keyword details: A list of additional details about the error. + :paramtype details: list[~azure.mgmt.appplatform.v2020_11_01_preview.models.CloudErrorBody] + """ super(CloudErrorBody, self).__init__(**kwargs) self.code = code self.message = message @@ -621,8 +721,8 @@ class ClusterResourceProperties(msrest.serialization.Model): "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 network_profile: Network profile of the Service. + :vartype 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. @@ -648,6 +748,10 @@ def __init__( network_profile: Optional["NetworkProfile"] = None, **kwargs ): + """ + :keyword network_profile: Network profile of the Service. + :paramtype network_profile: ~azure.mgmt.appplatform.v2020_11_01_preview.models.NetworkProfile + """ super(ClusterResourceProperties, self).__init__(**kwargs) self.provisioning_state = None self.network_profile = network_profile @@ -660,27 +764,27 @@ class ConfigServerGitProperty(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param repositories: Repositories of git. - :type repositories: + :ivar repositories: Repositories of git. + :vartype repositories: list[~azure.mgmt.appplatform.v2020_11_01_preview.models.GitPatternRepository] - :param uri: Required. URI of the repository. - :type uri: str - :param label: Label of the repository. - :type label: str - :param search_paths: Searching path of the repository. - :type search_paths: list[str] - :param username: Username of git repository basic auth. - :type username: str - :param password: Password of git repository basic auth. - :type password: str - :param host_key: Public sshKey of git repository. - :type host_key: str - :param host_key_algorithm: SshKey algorithm of git repository. - :type host_key_algorithm: str - :param private_key: Private sshKey algorithm of git repository. - :type private_key: str - :param strict_host_key_checking: Strict host key checking or not. - :type strict_host_key_checking: bool + :ivar uri: Required. URI of the repository. + :vartype uri: str + :ivar label: Label of the repository. + :vartype label: str + :ivar search_paths: Searching path of the repository. + :vartype search_paths: list[str] + :ivar username: Username of git repository basic auth. + :vartype username: str + :ivar password: Password of git repository basic auth. + :vartype password: str + :ivar host_key: Public sshKey of git repository. + :vartype host_key: str + :ivar host_key_algorithm: SshKey algorithm of git repository. + :vartype host_key_algorithm: str + :ivar private_key: Private sshKey algorithm of git repository. + :vartype private_key: str + :ivar strict_host_key_checking: Strict host key checking or not. + :vartype strict_host_key_checking: bool """ _validation = { @@ -715,6 +819,29 @@ def __init__( strict_host_key_checking: Optional[bool] = None, **kwargs ): + """ + :keyword repositories: Repositories of git. + :paramtype repositories: + list[~azure.mgmt.appplatform.v2020_11_01_preview.models.GitPatternRepository] + :keyword uri: Required. URI of the repository. + :paramtype uri: str + :keyword label: Label of the repository. + :paramtype label: str + :keyword search_paths: Searching path of the repository. + :paramtype search_paths: list[str] + :keyword username: Username of git repository basic auth. + :paramtype username: str + :keyword password: Password of git repository basic auth. + :paramtype password: str + :keyword host_key: Public sshKey of git repository. + :paramtype host_key: str + :keyword host_key_algorithm: SshKey algorithm of git repository. + :paramtype host_key_algorithm: str + :keyword private_key: Private sshKey algorithm of git repository. + :paramtype private_key: str + :keyword strict_host_key_checking: Strict host key checking or not. + :paramtype strict_host_key_checking: bool + """ super(ConfigServerGitProperty, self).__init__(**kwargs) self.repositories = repositories self.uri = uri @@ -737,10 +864,10 @@ class ConfigServerProperties(msrest.serialization.Model): "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 + :ivar error: Error when apply config server settings. + :vartype error: ~azure.mgmt.appplatform.v2020_11_01_preview.models.Error + :ivar config_server: Settings of config server. + :vartype config_server: ~azure.mgmt.appplatform.v2020_11_01_preview.models.ConfigServerSettings """ _validation = { @@ -760,6 +887,13 @@ def __init__( config_server: Optional["ConfigServerSettings"] = None, **kwargs ): + """ + :keyword error: Error when apply config server settings. + :paramtype error: ~azure.mgmt.appplatform.v2020_11_01_preview.models.Error + :keyword config_server: Settings of config server. + :paramtype config_server: + ~azure.mgmt.appplatform.v2020_11_01_preview.models.ConfigServerSettings + """ super(ConfigServerProperties, self).__init__(**kwargs) self.provisioning_state = None self.error = error @@ -777,8 +911,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 + :ivar properties: Properties of the Config Server resource. + :vartype properties: ~azure.mgmt.appplatform.v2020_11_01_preview.models.ConfigServerProperties """ _validation = { @@ -800,6 +934,11 @@ def __init__( properties: Optional["ConfigServerProperties"] = None, **kwargs ): + """ + :keyword properties: Properties of the Config Server resource. + :paramtype properties: + ~azure.mgmt.appplatform.v2020_11_01_preview.models.ConfigServerProperties + """ super(ConfigServerResource, self).__init__(**kwargs) self.properties = properties @@ -807,8 +946,9 @@ def __init__( 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 + :ivar git_property: Property of git environment. + :vartype git_property: + ~azure.mgmt.appplatform.v2020_11_01_preview.models.ConfigServerGitProperty """ _attribute_map = { @@ -821,6 +961,11 @@ def __init__( git_property: Optional["ConfigServerGitProperty"] = None, **kwargs ): + """ + :keyword git_property: Property of git environment. + :paramtype git_property: + ~azure.mgmt.appplatform.v2020_11_01_preview.models.ConfigServerGitProperty + """ super(ConfigServerSettings, self).__init__(**kwargs) self.git_property = git_property @@ -828,12 +973,12 @@ def __init__( class ConfigServerSettingsErrorRecord(msrest.serialization.Model): """Error record of the config server settings. - :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. - :type uri: str - :param messages: The detail error messages of the record. - :type messages: list[str] + :ivar name: The name of the config server settings error record. + :vartype name: str + :ivar uri: The uri of the config server settings error record. + :vartype uri: str + :ivar messages: The detail error messages of the record. + :vartype messages: list[str] """ _attribute_map = { @@ -850,6 +995,14 @@ def __init__( messages: Optional[List[str]] = None, **kwargs ): + """ + :keyword name: The name of the config server settings error record. + :paramtype name: str + :keyword uri: The uri of the config server settings error record. + :paramtype uri: str + :keyword messages: The detail error messages of the record. + :paramtype messages: list[str] + """ super(ConfigServerSettingsErrorRecord, self).__init__(**kwargs) self.name = name self.uri = uri @@ -859,10 +1012,10 @@ def __init__( class ConfigServerSettingsValidateResult(msrest.serialization.Model): """Validation result for config server settings. - :param is_valid: Indicate if the config server settings are valid. - :type is_valid: bool - :param details: The detail validation results. - :type details: + :ivar is_valid: Indicate if the config server settings are valid. + :vartype is_valid: bool + :ivar details: The detail validation results. + :vartype details: list[~azure.mgmt.appplatform.v2020_11_01_preview.models.ConfigServerSettingsErrorRecord] """ @@ -878,6 +1031,13 @@ def __init__( details: Optional[List["ConfigServerSettingsErrorRecord"]] = None, **kwargs ): + """ + :keyword is_valid: Indicate if the config server settings are valid. + :paramtype is_valid: bool + :keyword details: The detail validation results. + :paramtype details: + list[~azure.mgmt.appplatform.v2020_11_01_preview.models.ConfigServerSettingsErrorRecord] + """ super(ConfigServerSettingsValidateResult, self).__init__(**kwargs) self.is_valid = is_valid self.details = details @@ -888,12 +1048,12 @@ class CustomDomainProperties(msrest.serialization.Model): 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 + :ivar thumbprint: The thumbprint of bound certificate. + :vartype thumbprint: str :ivar app_name: The app name of domain. :vartype app_name: str - :param cert_name: The bound certificate name of domain. - :type cert_name: str + :ivar cert_name: The bound certificate name of domain. + :vartype cert_name: str """ _validation = { @@ -913,6 +1073,12 @@ def __init__( cert_name: Optional[str] = None, **kwargs ): + """ + :keyword thumbprint: The thumbprint of bound certificate. + :paramtype thumbprint: str + :keyword cert_name: The bound certificate name of domain. + :paramtype cert_name: str + """ super(CustomDomainProperties, self).__init__(**kwargs) self.thumbprint = thumbprint self.app_name = None @@ -930,8 +1096,8 @@ class CustomDomainResource(ProxyResource): :vartype name: str :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 + :ivar properties: Properties of the custom domain resource. + :vartype properties: ~azure.mgmt.appplatform.v2020_11_01_preview.models.CustomDomainProperties """ _validation = { @@ -953,6 +1119,11 @@ def __init__( properties: Optional["CustomDomainProperties"] = None, **kwargs ): + """ + :keyword properties: Properties of the custom domain resource. + :paramtype properties: + ~azure.mgmt.appplatform.v2020_11_01_preview.models.CustomDomainProperties + """ super(CustomDomainResource, self).__init__(**kwargs) self.properties = properties @@ -960,10 +1131,10 @@ def __init__( 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 + :ivar value: The custom domain resources list. + :vartype value: list[~azure.mgmt.appplatform.v2020_11_01_preview.models.CustomDomainResource] + :ivar next_link: The link to next page of custom domain list. + :vartype next_link: str """ _attribute_map = { @@ -978,6 +1149,12 @@ def __init__( next_link: Optional[str] = None, **kwargs ): + """ + :keyword value: The custom domain resources list. + :paramtype value: list[~azure.mgmt.appplatform.v2020_11_01_preview.models.CustomDomainResource] + :keyword next_link: The link to next page of custom domain list. + :paramtype next_link: str + """ super(CustomDomainResourceCollection, self).__init__(**kwargs) self.value = value self.next_link = next_link @@ -988,8 +1165,8 @@ class CustomDomainValidatePayload(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param name: Required. Name to be validated. - :type name: str + :ivar name: Required. Name to be validated. + :vartype name: str """ _validation = { @@ -1006,6 +1183,10 @@ def __init__( name: str, **kwargs ): + """ + :keyword name: Required. Name to be validated. + :paramtype name: str + """ super(CustomDomainValidatePayload, self).__init__(**kwargs) self.name = name @@ -1013,10 +1194,10 @@ def __init__( class CustomDomainValidateResult(msrest.serialization.Model): """Validation result for custom domain. - :param is_valid: Indicates if domain name is valid. - :type is_valid: bool - :param message: Message of why domain name is invalid. - :type message: str + :ivar is_valid: Indicates if domain name is valid. + :vartype is_valid: bool + :ivar message: Message of why domain name is invalid. + :vartype message: str """ _attribute_map = { @@ -1031,6 +1212,12 @@ def __init__( message: Optional[str] = None, **kwargs ): + """ + :keyword is_valid: Indicates if domain name is valid. + :paramtype is_valid: bool + :keyword message: Message of why domain name is invalid. + :paramtype message: str + """ super(CustomDomainValidateResult, self).__init__(**kwargs) self.is_valid = is_valid self.message = message @@ -1073,6 +1260,8 @@ def __init__( self, **kwargs ): + """ + """ super(DeploymentInstance, self).__init__(**kwargs) self.name = None self.status = None @@ -1092,11 +1281,11 @@ 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: + :ivar properties: Properties of the Deployment resource. + :vartype 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 + :ivar sku: Sku of the Deployment resource. + :vartype sku: ~azure.mgmt.appplatform.v2020_11_01_preview.models.Sku """ _validation = { @@ -1120,6 +1309,13 @@ def __init__( sku: Optional["Sku"] = None, **kwargs ): + """ + :keyword properties: Properties of the Deployment resource. + :paramtype properties: + ~azure.mgmt.appplatform.v2020_11_01_preview.models.DeploymentResourceProperties + :keyword sku: Sku of the Deployment resource. + :paramtype sku: ~azure.mgmt.appplatform.v2020_11_01_preview.models.Sku + """ super(DeploymentResource, self).__init__(**kwargs) self.properties = properties self.sku = sku @@ -1128,11 +1324,11 @@ def __init__( 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). + :ivar value: Collection of Deployment resources. + :vartype value: list[~azure.mgmt.appplatform.v2020_11_01_preview.models.DeploymentResource] + :ivar 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 + :vartype next_link: str """ _attribute_map = { @@ -1147,6 +1343,13 @@ def __init__( next_link: Optional[str] = None, **kwargs ): + """ + :keyword value: Collection of Deployment resources. + :paramtype value: list[~azure.mgmt.appplatform.v2020_11_01_preview.models.DeploymentResource] + :keyword next_link: URL client should use to fetch the next page (per server side paging). + It's null for now, added for future use. + :paramtype next_link: str + """ super(DeploymentResourceCollection, self).__init__(**kwargs) self.value = value self.next_link = next_link @@ -1157,12 +1360,12 @@ class DeploymentResourceProperties(msrest.serialization.Model): 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 source: Uploaded source information of the deployment. + :vartype 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. - :type deployment_settings: + :ivar deployment_settings: Deployment settings of the Deployment. + :vartype 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". @@ -1207,6 +1410,13 @@ def __init__( deployment_settings: Optional["DeploymentSettings"] = None, **kwargs ): + """ + :keyword source: Uploaded source information of the deployment. + :paramtype source: ~azure.mgmt.appplatform.v2020_11_01_preview.models.UserSourceInfo + :keyword deployment_settings: Deployment settings of the Deployment. + :paramtype deployment_settings: + ~azure.mgmt.appplatform.v2020_11_01_preview.models.DeploymentSettings + """ super(DeploymentResourceProperties, self).__init__(**kwargs) self.source = source self.app_name = None @@ -1221,20 +1431,21 @@ def __init__( 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). - :type cpu: int - :param memory_in_gb: Required Memory size in GB, basic tier should be in range (1, 2), standard + :ivar cpu: Required CPU, basic tier should be 1, standard tier should be in range (1, 4). + :vartype cpu: int + :ivar 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. - :type jvm_options: str - :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. - :type environment_variables: dict[str, str] - :param runtime_version: Runtime version. Possible values include: "Java_8", "Java_11", + :vartype memory_in_gb: int + :ivar jvm_options: JVM parameter. + :vartype jvm_options: str + :ivar net_core_main_entry_path: The path to the .NET executable relative to zip root. + :vartype net_core_main_entry_path: str + :ivar environment_variables: Collection of environment variables. + :vartype environment_variables: dict[str, str] + :ivar 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 + :vartype runtime_version: str or + ~azure.mgmt.appplatform.v2020_11_01_preview.models.RuntimeVersion """ _attribute_map = { @@ -1257,6 +1468,23 @@ def __init__( runtime_version: Optional[Union[str, "RuntimeVersion"]] = "Java_8", **kwargs ): + """ + :keyword cpu: Required CPU, basic tier should be 1, standard tier should be in range (1, 4). + :paramtype cpu: int + :keyword memory_in_gb: Required Memory size in GB, basic tier should be in range (1, 2), + standard tier should be in range (1, 8). + :paramtype memory_in_gb: int + :keyword jvm_options: JVM parameter. + :paramtype jvm_options: str + :keyword net_core_main_entry_path: The path to the .NET executable relative to zip root. + :paramtype net_core_main_entry_path: str + :keyword environment_variables: Collection of environment variables. + :paramtype environment_variables: dict[str, str] + :keyword runtime_version: Runtime version. Possible values include: "Java_8", "Java_11", + "NetCore_31". Default value: "Java_8". + :paramtype runtime_version: str or + ~azure.mgmt.appplatform.v2020_11_01_preview.models.RuntimeVersion + """ super(DeploymentSettings, self).__init__(**kwargs) self.cpu = cpu self.memory_in_gb = memory_in_gb @@ -1269,10 +1497,10 @@ def __init__( class Error(msrest.serialization.Model): """The error code compose of code and message. - :param code: The code of error. - :type code: str - :param message: The message of error. - :type message: str + :ivar code: The code of error. + :vartype code: str + :ivar message: The message of error. + :vartype message: str """ _attribute_map = { @@ -1287,6 +1515,12 @@ def __init__( message: Optional[str] = None, **kwargs ): + """ + :keyword code: The code of error. + :paramtype code: str + :keyword message: The message of error. + :paramtype message: str + """ super(Error, self).__init__(**kwargs) self.code = code self.message = message @@ -1297,28 +1531,28 @@ class GitPatternRepository(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param name: Required. Name of the repository. - :type name: str - :param pattern: Collection of pattern of the repository. - :type pattern: list[str] - :param uri: Required. URI of the repository. - :type uri: str - :param label: Label of the repository. - :type label: str - :param search_paths: Searching path of the repository. - :type search_paths: list[str] - :param username: Username of git repository basic auth. - :type username: str - :param password: Password of git repository basic auth. - :type password: str - :param host_key: Public sshKey of git repository. - :type host_key: str - :param host_key_algorithm: SshKey algorithm of git repository. - :type host_key_algorithm: str - :param private_key: Private sshKey algorithm of git repository. - :type private_key: str - :param strict_host_key_checking: Strict host key checking or not. - :type strict_host_key_checking: bool + :ivar name: Required. Name of the repository. + :vartype name: str + :ivar pattern: Collection of pattern of the repository. + :vartype pattern: list[str] + :ivar uri: Required. URI of the repository. + :vartype uri: str + :ivar label: Label of the repository. + :vartype label: str + :ivar search_paths: Searching path of the repository. + :vartype search_paths: list[str] + :ivar username: Username of git repository basic auth. + :vartype username: str + :ivar password: Password of git repository basic auth. + :vartype password: str + :ivar host_key: Public sshKey of git repository. + :vartype host_key: str + :ivar host_key_algorithm: SshKey algorithm of git repository. + :vartype host_key_algorithm: str + :ivar private_key: Private sshKey algorithm of git repository. + :vartype private_key: str + :ivar strict_host_key_checking: Strict host key checking or not. + :vartype strict_host_key_checking: bool """ _validation = { @@ -1356,6 +1590,30 @@ def __init__( strict_host_key_checking: Optional[bool] = None, **kwargs ): + """ + :keyword name: Required. Name of the repository. + :paramtype name: str + :keyword pattern: Collection of pattern of the repository. + :paramtype pattern: list[str] + :keyword uri: Required. URI of the repository. + :paramtype uri: str + :keyword label: Label of the repository. + :paramtype label: str + :keyword search_paths: Searching path of the repository. + :paramtype search_paths: list[str] + :keyword username: Username of git repository basic auth. + :paramtype username: str + :keyword password: Password of git repository basic auth. + :paramtype password: str + :keyword host_key: Public sshKey of git repository. + :paramtype host_key: str + :keyword host_key_algorithm: SshKey algorithm of git repository. + :paramtype host_key_algorithm: str + :keyword private_key: Private sshKey algorithm of git repository. + :paramtype private_key: str + :keyword strict_host_key_checking: Strict host key checking or not. + :paramtype strict_host_key_checking: bool + """ super(GitPatternRepository, self).__init__(**kwargs) self.name = name self.pattern = pattern @@ -1375,8 +1633,8 @@ class LogFileUrlResponse(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param url: Required. URL of the log file. - :type url: str + :ivar url: Required. URL of the log file. + :vartype url: str """ _validation = { @@ -1393,6 +1651,10 @@ def __init__( url: str, **kwargs ): + """ + :keyword url: Required. URL of the log file. + :paramtype url: str + """ super(LogFileUrlResponse, self).__init__(**kwargs) self.url = url @@ -1400,12 +1662,12 @@ def __init__( class LogSpecification(msrest.serialization.Model): """Specifications of the Log for Azure Monitoring. - :param name: Name of the log. - :type name: str - :param display_name: Localized friendly display name of the log. - :type display_name: str - :param blob_duration: Blob duration of the log. - :type blob_duration: str + :ivar name: Name of the log. + :vartype name: str + :ivar display_name: Localized friendly display name of the log. + :vartype display_name: str + :ivar blob_duration: Blob duration of the log. + :vartype blob_duration: str """ _attribute_map = { @@ -1422,6 +1684,14 @@ def __init__( blob_duration: Optional[str] = None, **kwargs ): + """ + :keyword name: Name of the log. + :paramtype name: str + :keyword display_name: Localized friendly display name of the log. + :paramtype display_name: str + :keyword blob_duration: Blob duration of the log. + :paramtype blob_duration: str + """ super(LogSpecification, self).__init__(**kwargs) self.name = name self.display_name = display_name @@ -1431,13 +1701,13 @@ def __init__( 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", + :ivar 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. - :type tenant_id: str + :vartype type: str or ~azure.mgmt.appplatform.v2020_11_01_preview.models.ManagedIdentityType + :ivar principal_id: Principal Id. + :vartype principal_id: str + :ivar tenant_id: Tenant Id. + :vartype tenant_id: str """ _attribute_map = { @@ -1454,6 +1724,15 @@ def __init__( tenant_id: Optional[str] = None, **kwargs ): + """ + :keyword type: Type of the managed identity. Possible values include: "None", "SystemAssigned", + "UserAssigned", "SystemAssigned,UserAssigned". + :paramtype type: str or ~azure.mgmt.appplatform.v2020_11_01_preview.models.ManagedIdentityType + :keyword principal_id: Principal Id. + :paramtype principal_id: str + :keyword tenant_id: Tenant Id. + :paramtype tenant_id: str + """ super(ManagedIdentityProperties, self).__init__(**kwargs) self.type = type self.principal_id = principal_id @@ -1463,13 +1742,13 @@ def __init__( class MetricDimension(msrest.serialization.Model): """Specifications of the Dimension of metrics. - :param name: Name of the dimension. - :type name: str - :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 + :ivar name: Name of the dimension. + :vartype name: str + :ivar display_name: Localized friendly display name of the dimension. + :vartype display_name: str + :ivar to_be_exported_for_shoebox: Whether this dimension should be included for the Shoebox export scenario. - :type to_be_exported_for_shoebox: bool + :vartype to_be_exported_for_shoebox: bool """ _attribute_map = { @@ -1486,6 +1765,15 @@ def __init__( to_be_exported_for_shoebox: Optional[bool] = None, **kwargs ): + """ + :keyword name: Name of the dimension. + :paramtype name: str + :keyword display_name: Localized friendly display name of the dimension. + :paramtype display_name: str + :keyword to_be_exported_for_shoebox: Whether this dimension should be included for the Shoebox + export scenario. + :paramtype to_be_exported_for_shoebox: bool + """ super(MetricDimension, self).__init__(**kwargs) self.name = name self.display_name = display_name @@ -1495,29 +1783,31 @@ def __init__( class MetricSpecification(msrest.serialization.Model): """Specifications of the Metrics for Azure Monitoring. - :param name: Name of the metric. - :type name: str - :param display_name: Localized friendly display name of the metric. - :type display_name: str - :param display_description: Localized friendly description of the metric. - :type display_description: str - :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 + :ivar name: Name of the metric. + :vartype name: str + :ivar display_name: Localized friendly display name of the metric. + :vartype display_name: str + :ivar display_description: Localized friendly description of the metric. + :vartype display_description: str + :ivar unit: Unit that makes sense for the metric. + :vartype unit: str + :ivar 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, + :vartype category: str + :ivar 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. - :type supported_aggregation_types: list[str] - :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 + :vartype aggregation_type: str + :ivar supported_aggregation_types: Supported aggregation types. + :vartype supported_aggregation_types: list[str] + :ivar supported_time_grain_types: Supported time grain types. + :vartype supported_time_grain_types: list[str] + :ivar 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] + :vartype fill_gap_with_zero: bool + :ivar dimensions: Dimensions of the metric. + :vartype dimensions: list[~azure.mgmt.appplatform.v2020_11_01_preview.models.MetricDimension] + :ivar source_mdm_namespace: Name of the MDM namespace. Optional. + :vartype source_mdm_namespace: str """ _attribute_map = { @@ -1531,6 +1821,7 @@ class MetricSpecification(msrest.serialization.Model): 'supported_time_grain_types': {'key': 'supportedTimeGrainTypes', 'type': '[str]'}, 'fill_gap_with_zero': {'key': 'fillGapWithZero', 'type': 'bool'}, 'dimensions': {'key': 'dimensions', 'type': '[MetricDimension]'}, + 'source_mdm_namespace': {'key': 'sourceMdmNamespace', 'type': 'str'}, } def __init__( @@ -1546,8 +1837,36 @@ def __init__( supported_time_grain_types: Optional[List[str]] = None, fill_gap_with_zero: Optional[bool] = None, dimensions: Optional[List["MetricDimension"]] = None, - **kwargs - ): + source_mdm_namespace: Optional[str] = None, + **kwargs + ): + """ + :keyword name: Name of the metric. + :paramtype name: str + :keyword display_name: Localized friendly display name of the metric. + :paramtype display_name: str + :keyword display_description: Localized friendly description of the metric. + :paramtype display_description: str + :keyword unit: Unit that makes sense for the metric. + :paramtype unit: str + :keyword category: Name of the metric category that the metric belongs to. A metric can only + belong to a single category. + :paramtype category: str + :keyword aggregation_type: Only provide one value for this field. Valid values: Average, + Minimum, Maximum, Total, Count. + :paramtype aggregation_type: str + :keyword supported_aggregation_types: Supported aggregation types. + :paramtype supported_aggregation_types: list[str] + :keyword supported_time_grain_types: Supported time grain types. + :paramtype supported_time_grain_types: list[str] + :keyword fill_gap_with_zero: Optional. If set to true, then zero will be returned for time + duration where no metric is emitted/published. + :paramtype fill_gap_with_zero: bool + :keyword dimensions: Dimensions of the metric. + :paramtype dimensions: list[~azure.mgmt.appplatform.v2020_11_01_preview.models.MetricDimension] + :keyword source_mdm_namespace: Name of the MDM namespace. Optional. + :paramtype source_mdm_namespace: str + """ super(MetricSpecification, self).__init__(**kwargs) self.name = name self.display_name = display_name @@ -1559,6 +1878,7 @@ def __init__( self.supported_time_grain_types = supported_time_grain_types self.fill_gap_with_zero = fill_gap_with_zero self.dimensions = dimensions + self.source_mdm_namespace = source_mdm_namespace class MonitoringSettingProperties(msrest.serialization.Model): @@ -1570,20 +1890,20 @@ class MonitoringSettingProperties(msrest.serialization.Model): "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. - :type trace_enabled: bool - :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, + :ivar error: Error when apply Monitoring Setting changes. + :vartype error: ~azure.mgmt.appplatform.v2020_11_01_preview.models.Error + :ivar 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. + :vartype trace_enabled: bool + :ivar app_insights_instrumentation_key: Target application insight instrumentation key, null or + whitespace include empty will disable monitoringSettings. + :vartype app_insights_instrumentation_key: str + :ivar 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. - :type app_insights_agent_versions: + :vartype app_insights_sampling_rate: float + :ivar app_insights_agent_versions: Indicates the versions of application insight agent. + :vartype app_insights_agent_versions: ~azure.mgmt.appplatform.v2020_11_01_preview.models.ApplicationInsightsAgentVersions """ @@ -1611,6 +1931,23 @@ def __init__( app_insights_agent_versions: Optional["ApplicationInsightsAgentVersions"] = None, **kwargs ): + """ + :keyword error: Error when apply Monitoring Setting changes. + :paramtype error: ~azure.mgmt.appplatform.v2020_11_01_preview.models.Error + :keyword 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. + :paramtype trace_enabled: bool + :keyword app_insights_instrumentation_key: Target application insight instrumentation key, null + or whitespace include empty will disable monitoringSettings. + :paramtype app_insights_instrumentation_key: str + :keyword app_insights_sampling_rate: Indicates the sampling rate of application insight agent, + should be in range [0.0, 100.0]. + :paramtype app_insights_sampling_rate: float + :keyword app_insights_agent_versions: Indicates the versions of application insight agent. + :paramtype app_insights_agent_versions: + ~azure.mgmt.appplatform.v2020_11_01_preview.models.ApplicationInsightsAgentVersions + """ super(MonitoringSettingProperties, self).__init__(**kwargs) self.provisioning_state = None self.error = error @@ -1631,8 +1968,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: + :ivar properties: Properties of the Monitoring Setting resource. + :vartype properties: ~azure.mgmt.appplatform.v2020_11_01_preview.models.MonitoringSettingProperties """ @@ -1655,6 +1992,11 @@ def __init__( properties: Optional["MonitoringSettingProperties"] = None, **kwargs ): + """ + :keyword properties: Properties of the Monitoring Setting resource. + :paramtype properties: + ~azure.mgmt.appplatform.v2020_11_01_preview.models.MonitoringSettingProperties + """ super(MonitoringSettingResource, self).__init__(**kwargs) self.properties = properties @@ -1662,12 +2004,12 @@ def __init__( class NameAvailability(msrest.serialization.Model): """Name availability result payload. - :param name_available: Indicates whether the name is available. - :type name_available: bool - :param reason: Reason why the name is not available. - :type reason: str - :param message: Message why the name is not available. - :type message: str + :ivar name_available: Indicates whether the name is available. + :vartype name_available: bool + :ivar reason: Reason why the name is not available. + :vartype reason: str + :ivar message: Message why the name is not available. + :vartype message: str """ _attribute_map = { @@ -1684,6 +2026,14 @@ def __init__( message: Optional[str] = None, **kwargs ): + """ + :keyword name_available: Indicates whether the name is available. + :paramtype name_available: bool + :keyword reason: Reason why the name is not available. + :paramtype reason: str + :keyword message: Message why the name is not available. + :paramtype message: str + """ super(NameAvailability, self).__init__(**kwargs) self.name_available = name_available self.reason = reason @@ -1695,10 +2045,10 @@ class NameAvailabilityParameters(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param type: Required. Type of the resource to check name availability. - :type type: str - :param name: Required. Name to be checked. - :type name: str + :ivar type: Required. Type of the resource to check name availability. + :vartype type: str + :ivar name: Required. Name to be checked. + :vartype name: str """ _validation = { @@ -1718,6 +2068,12 @@ def __init__( name: str, **kwargs ): + """ + :keyword type: Required. Type of the resource to check name availability. + :paramtype type: str + :keyword name: Required. Name to be checked. + :paramtype name: str + """ super(NameAvailabilityParameters, self).__init__(**kwargs) self.type = type self.name = name @@ -1728,20 +2084,19 @@ class NetworkProfile(msrest.serialization.Model): 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. - :type service_runtime_subnet_id: str - :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. - :type service_cidr: str - :param service_runtime_network_resource_group: Name of the resource group containing network + :ivar service_runtime_subnet_id: Fully qualified resource Id of the subnet to host Azure Spring + Cloud Service Runtime. + :vartype service_runtime_subnet_id: str + :ivar app_subnet_id: Fully qualified resource Id of the subnet to host Azure Spring Cloud Apps. + :vartype app_subnet_id: str + :ivar service_cidr: Azure Spring Cloud service reserved CIDR. + :vartype service_cidr: str + :ivar 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 + :vartype service_runtime_network_resource_group: str + :ivar app_network_resource_group: Name of the resource group containing network resources of Azure Spring Cloud Apps. - :type app_network_resource_group: str + :vartype app_network_resource_group: str :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 @@ -1775,6 +2130,22 @@ def __init__( app_network_resource_group: Optional[str] = None, **kwargs ): + """ + :keyword service_runtime_subnet_id: Fully qualified resource Id of the subnet to host Azure + Spring Cloud Service Runtime. + :paramtype service_runtime_subnet_id: str + :keyword app_subnet_id: Fully qualified resource Id of the subnet to host Azure Spring Cloud + Apps. + :paramtype app_subnet_id: str + :keyword service_cidr: Azure Spring Cloud service reserved CIDR. + :paramtype service_cidr: str + :keyword service_runtime_network_resource_group: Name of the resource group containing network + resources of Azure Spring Cloud Service Runtime. + :paramtype service_runtime_network_resource_group: str + :keyword app_network_resource_group: Name of the resource group containing network resources of + Azure Spring Cloud Apps. + :paramtype app_network_resource_group: str + """ super(NetworkProfile, self).__init__(**kwargs) self.service_runtime_subnet_id = service_runtime_subnet_id self.app_subnet_id = app_subnet_id @@ -1806,6 +2177,8 @@ def __init__( self, **kwargs ): + """ + """ super(NetworkProfileOutboundIPs, self).__init__(**kwargs) self.public_i_ps = None @@ -1813,22 +2186,32 @@ def __init__( class OperationDetail(msrest.serialization.Model): """Operation detail payload. - :param name: Name of the operation. - :type name: str - :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. - :type origin: str - :param properties: Properties of the operation. - :type properties: ~azure.mgmt.appplatform.v2020_11_01_preview.models.OperationProperties + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar name: Name of the operation. + :vartype name: str + :ivar is_data_action: Indicates whether the operation is a data action. + :vartype is_data_action: bool + :ivar display: Display of the operation. + :vartype display: ~azure.mgmt.appplatform.v2020_11_01_preview.models.OperationDisplay + :ivar action_type: Enum. Indicates the action type. "Internal" refers to actions that are for + internal only APIs. Possible values include: "Internal". + :vartype action_type: str or ~azure.mgmt.appplatform.v2020_11_01_preview.models.ActionType + :ivar origin: Origin of the operation. + :vartype origin: str + :ivar properties: Properties of the operation. + :vartype properties: ~azure.mgmt.appplatform.v2020_11_01_preview.models.OperationProperties """ + _validation = { + 'action_type': {'readonly': True}, + } + _attribute_map = { 'name': {'key': 'name', 'type': 'str'}, 'is_data_action': {'key': 'isDataAction', 'type': 'bool'}, 'display': {'key': 'display', 'type': 'OperationDisplay'}, + 'action_type': {'key': 'actionType', 'type': 'str'}, 'origin': {'key': 'origin', 'type': 'str'}, 'properties': {'key': 'properties', 'type': 'OperationProperties'}, } @@ -1843,10 +2226,23 @@ def __init__( properties: Optional["OperationProperties"] = None, **kwargs ): + """ + :keyword name: Name of the operation. + :paramtype name: str + :keyword is_data_action: Indicates whether the operation is a data action. + :paramtype is_data_action: bool + :keyword display: Display of the operation. + :paramtype display: ~azure.mgmt.appplatform.v2020_11_01_preview.models.OperationDisplay + :keyword origin: Origin of the operation. + :paramtype origin: str + :keyword properties: Properties of the operation. + :paramtype properties: ~azure.mgmt.appplatform.v2020_11_01_preview.models.OperationProperties + """ super(OperationDetail, self).__init__(**kwargs) self.name = name self.is_data_action = is_data_action self.display = display + self.action_type = None self.origin = origin self.properties = properties @@ -1854,14 +2250,14 @@ def __init__( class OperationDisplay(msrest.serialization.Model): """Operation display payload. - :param provider: Resource provider of the operation. - :type provider: str - :param resource: Resource of the operation. - :type resource: str - :param operation: Localized friendly name for the operation. - :type operation: str - :param description: Localized friendly description for the operation. - :type description: str + :ivar provider: Resource provider of the operation. + :vartype provider: str + :ivar resource: Resource of the operation. + :vartype resource: str + :ivar operation: Localized friendly name for the operation. + :vartype operation: str + :ivar description: Localized friendly description for the operation. + :vartype description: str """ _attribute_map = { @@ -1880,6 +2276,16 @@ def __init__( description: Optional[str] = None, **kwargs ): + """ + :keyword provider: Resource provider of the operation. + :paramtype provider: str + :keyword resource: Resource of the operation. + :paramtype resource: str + :keyword operation: Localized friendly name for the operation. + :paramtype operation: str + :keyword description: Localized friendly description for the operation. + :paramtype description: str + """ super(OperationDisplay, self).__init__(**kwargs) self.provider = provider self.resource = resource @@ -1890,8 +2296,8 @@ def __init__( class OperationProperties(msrest.serialization.Model): """Extra Operation properties. - :param service_specification: Service specifications of the operation. - :type service_specification: + :ivar service_specification: Service specifications of the operation. + :vartype service_specification: ~azure.mgmt.appplatform.v2020_11_01_preview.models.ServiceSpecification """ @@ -1905,6 +2311,11 @@ def __init__( service_specification: Optional["ServiceSpecification"] = None, **kwargs ): + """ + :keyword service_specification: Service specifications of the operation. + :paramtype service_specification: + ~azure.mgmt.appplatform.v2020_11_01_preview.models.ServiceSpecification + """ super(OperationProperties, self).__init__(**kwargs) self.service_specification = service_specification @@ -1914,12 +2325,12 @@ class PersistentDisk(msrest.serialization.Model): 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. - :type size_in_gb: int + :ivar size_in_gb: Size of the persistent disk in GB. + :vartype size_in_gb: int :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. - :type mount_path: str + :ivar mount_path: Mount path of the persistent disk. + :vartype mount_path: str """ _validation = { @@ -1940,6 +2351,12 @@ def __init__( mount_path: Optional[str] = None, **kwargs ): + """ + :keyword size_in_gb: Size of the persistent disk in GB. + :paramtype size_in_gb: int + :keyword mount_path: Mount path of the persistent disk. + :paramtype mount_path: str + """ super(PersistentDisk, self).__init__(**kwargs) self.size_in_gb = size_in_gb self.used_in_gb = None @@ -1951,9 +2368,9 @@ class RegenerateTestKeyRequestPayload(msrest.serialization.Model): 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", + :ivar 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 + :vartype key_type: str or ~azure.mgmt.appplatform.v2020_11_01_preview.models.TestKeyType """ _validation = { @@ -1970,6 +2387,11 @@ def __init__( key_type: Union[str, "TestKeyType"], **kwargs ): + """ + :keyword key_type: Required. Type of the test key. Possible values include: "Primary", + "Secondary". + :paramtype key_type: str or ~azure.mgmt.appplatform.v2020_11_01_preview.models.TestKeyType + """ super(RegenerateTestKeyRequestPayload, self).__init__(**kwargs) self.key_type = key_type @@ -2012,6 +2434,8 @@ def __init__( self, **kwargs ): + """ + """ super(RequiredTraffic, self).__init__(**kwargs) self.protocol = None self.port = None @@ -2023,23 +2447,23 @@ def __init__( class ResourceSku(msrest.serialization.Model): """Describes an available Azure Spring Cloud SKU. - :param resource_type: Gets the type of resource the SKU applies to. - :type resource_type: str - :param name: Gets the name of SKU. - :type name: str - :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 - :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 + :ivar resource_type: Gets the type of resource the SKU applies to. + :vartype resource_type: str + :ivar name: Gets the name of SKU. + :vartype name: str + :ivar tier: Gets the tier of SKU. + :vartype tier: str + :ivar capacity: Gets the capacity of SKU. + :vartype capacity: ~azure.mgmt.appplatform.v2020_11_01_preview.models.SkuCapacity + :ivar locations: Gets the set of locations that the SKU is available. + :vartype locations: list[str] + :ivar location_info: Gets a list of locations and availability zones in those locations where the SKU is available. - :type location_info: + :vartype 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 + :ivar restrictions: Gets the restrictions because of which SKU cannot be used. This is empty if there are no restrictions. - :type restrictions: + :vartype restrictions: list[~azure.mgmt.appplatform.v2020_11_01_preview.models.ResourceSkuRestrictions] """ @@ -2065,6 +2489,26 @@ def __init__( restrictions: Optional[List["ResourceSkuRestrictions"]] = None, **kwargs ): + """ + :keyword resource_type: Gets the type of resource the SKU applies to. + :paramtype resource_type: str + :keyword name: Gets the name of SKU. + :paramtype name: str + :keyword tier: Gets the tier of SKU. + :paramtype tier: str + :keyword capacity: Gets the capacity of SKU. + :paramtype capacity: ~azure.mgmt.appplatform.v2020_11_01_preview.models.SkuCapacity + :keyword locations: Gets the set of locations that the SKU is available. + :paramtype locations: list[str] + :keyword location_info: Gets a list of locations and availability zones in those locations + where the SKU is available. + :paramtype location_info: + list[~azure.mgmt.appplatform.v2020_11_01_preview.models.ResourceSkuLocationInfo] + :keyword restrictions: Gets the restrictions because of which SKU cannot be used. This is + empty if there are no restrictions. + :paramtype restrictions: + list[~azure.mgmt.appplatform.v2020_11_01_preview.models.ResourceSkuRestrictions] + """ super(ResourceSku, self).__init__(**kwargs) self.resource_type = resource_type self.name = name @@ -2078,10 +2522,10 @@ def __init__( class ResourceSkuCapabilities(msrest.serialization.Model): """ResourceSkuCapabilities. - :param name: Gets an invariant to describe the feature. - :type name: str - :param value: Gets an invariant if the feature is measured by quantity. - :type value: str + :ivar name: Gets an invariant to describe the feature. + :vartype name: str + :ivar value: Gets an invariant if the feature is measured by quantity. + :vartype value: str """ _attribute_map = { @@ -2096,6 +2540,12 @@ def __init__( value: Optional[str] = None, **kwargs ): + """ + :keyword name: Gets an invariant to describe the feature. + :paramtype name: str + :keyword value: Gets an invariant if the feature is measured by quantity. + :paramtype value: str + """ super(ResourceSkuCapabilities, self).__init__(**kwargs) self.name = name self.value = value @@ -2104,11 +2554,11 @@ def __init__( 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). + :ivar value: Collection of resource SKU. + :vartype value: list[~azure.mgmt.appplatform.v2020_11_01_preview.models.ResourceSku] + :ivar 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 + :vartype next_link: str """ _attribute_map = { @@ -2123,6 +2573,13 @@ def __init__( next_link: Optional[str] = None, **kwargs ): + """ + :keyword value: Collection of resource SKU. + :paramtype value: list[~azure.mgmt.appplatform.v2020_11_01_preview.models.ResourceSku] + :keyword next_link: URL client should use to fetch the next page (per server side paging). + It's null for now, added for future use. + :paramtype next_link: str + """ super(ResourceSkuCollection, self).__init__(**kwargs) self.value = value self.next_link = next_link @@ -2131,12 +2588,12 @@ def __init__( class ResourceSkuLocationInfo(msrest.serialization.Model): """Locations and availability zones where the SKU is available. - :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: + :ivar location: Gets location of the SKU. + :vartype location: str + :ivar zones: Gets list of availability zones where the SKU is supported. + :vartype zones: list[str] + :ivar zone_details: Gets details of capabilities available to a SKU in specific zones. + :vartype zone_details: list[~azure.mgmt.appplatform.v2020_11_01_preview.models.ResourceSkuZoneDetails] """ @@ -2154,6 +2611,15 @@ def __init__( zone_details: Optional[List["ResourceSkuZoneDetails"]] = None, **kwargs ): + """ + :keyword location: Gets location of the SKU. + :paramtype location: str + :keyword zones: Gets list of availability zones where the SKU is supported. + :paramtype zones: list[str] + :keyword zone_details: Gets details of capabilities available to a SKU in specific zones. + :paramtype zone_details: + list[~azure.mgmt.appplatform.v2020_11_01_preview.models.ResourceSkuZoneDetails] + """ super(ResourceSkuLocationInfo, self).__init__(**kwargs) self.location = location self.zones = zones @@ -2163,10 +2629,10 @@ def __init__( class ResourceSkuRestrictionInfo(msrest.serialization.Model): """Information about the restriction where the SKU cannot be used. - :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] + :ivar locations: Gets locations where the SKU is restricted. + :vartype locations: list[str] + :ivar zones: Gets list of availability zones where the SKU is restricted. + :vartype zones: list[str] """ _attribute_map = { @@ -2181,6 +2647,12 @@ def __init__( zones: Optional[List[str]] = None, **kwargs ): + """ + :keyword locations: Gets locations where the SKU is restricted. + :paramtype locations: list[str] + :keyword zones: Gets list of availability zones where the SKU is restricted. + :paramtype zones: list[str] + """ super(ResourceSkuRestrictionInfo, self).__init__(**kwargs) self.locations = locations self.zones = zones @@ -2189,21 +2661,21 @@ def __init__( class ResourceSkuRestrictions(msrest.serialization.Model): """Restrictions where the SKU cannot be used. - :param type: Gets the type of restrictions. Possible values include: 'Location', 'Zone'. + :ivar type: Gets the type of restrictions. Possible values include: 'Location', 'Zone'. Possible values include: "Location", "Zone". - :type type: str or + :vartype 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 + :ivar 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 + :vartype values: list[str] + :ivar restriction_info: Gets the information about the restriction where the SKU cannot be used. - :type restriction_info: + :vartype restriction_info: ~azure.mgmt.appplatform.v2020_11_01_preview.models.ResourceSkuRestrictionInfo - :param reason_code: Gets the reason for restriction. Possible values include: 'QuotaId', + :ivar reason_code: Gets the reason for restriction. Possible values include: 'QuotaId', 'NotAvailableForSubscription'. Possible values include: "QuotaId", "NotAvailableForSubscription". - :type reason_code: str or + :vartype reason_code: str or ~azure.mgmt.appplatform.v2020_11_01_preview.models.ResourceSkuRestrictionsReasonCode """ @@ -2223,6 +2695,24 @@ def __init__( reason_code: Optional[Union[str, "ResourceSkuRestrictionsReasonCode"]] = None, **kwargs ): + """ + :keyword type: Gets the type of restrictions. Possible values include: 'Location', 'Zone'. + Possible values include: "Location", "Zone". + :paramtype type: str or + ~azure.mgmt.appplatform.v2020_11_01_preview.models.ResourceSkuRestrictionsType + :keyword values: Gets the value of restrictions. If the restriction type is set to + location. This would be different locations where the SKU is restricted. + :paramtype values: list[str] + :keyword restriction_info: Gets the information about the restriction where the SKU cannot be + used. + :paramtype restriction_info: + ~azure.mgmt.appplatform.v2020_11_01_preview.models.ResourceSkuRestrictionInfo + :keyword reason_code: Gets the reason for restriction. Possible values include: 'QuotaId', + 'NotAvailableForSubscription'. Possible values include: "QuotaId", + "NotAvailableForSubscription". + :paramtype reason_code: str or + ~azure.mgmt.appplatform.v2020_11_01_preview.models.ResourceSkuRestrictionsReasonCode + """ super(ResourceSkuRestrictions, self).__init__(**kwargs) self.type = type self.values = values @@ -2233,12 +2723,12 @@ def __init__( 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 + :ivar 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 + :vartype name: list[str] + :ivar capabilities: Gets a list of capabilities that are available for the SKU in the specified list of zones. - :type capabilities: + :vartype capabilities: list[~azure.mgmt.appplatform.v2020_11_01_preview.models.ResourceSkuCapabilities] """ @@ -2254,6 +2744,15 @@ def __init__( capabilities: Optional[List["ResourceSkuCapabilities"]] = None, **kwargs ): + """ + :keyword name: Gets the set of zones that the SKU is available in with the + specified capabilities. + :paramtype name: list[str] + :keyword capabilities: Gets a list of capabilities that are available for the SKU in the + specified list of zones. + :paramtype capabilities: + list[~azure.mgmt.appplatform.v2020_11_01_preview.models.ResourceSkuCapabilities] + """ super(ResourceSkuZoneDetails, self).__init__(**kwargs) self.name = name self.capabilities = capabilities @@ -2262,10 +2761,10 @@ def __init__( class ResourceUploadDefinition(msrest.serialization.Model): """Resource upload definition payload. - :param relative_path: Source relative path. - :type relative_path: str - :param upload_url: Upload URL. - :type upload_url: str + :ivar relative_path: Source relative path. + :vartype relative_path: str + :ivar upload_url: Upload URL. + :vartype upload_url: str """ _attribute_map = { @@ -2280,6 +2779,12 @@ def __init__( upload_url: Optional[str] = None, **kwargs ): + """ + :keyword relative_path: Source relative path. + :paramtype relative_path: str + :keyword upload_url: Upload URL. + :paramtype upload_url: str + """ super(ResourceUploadDefinition, self).__init__(**kwargs) self.relative_path = relative_path self.upload_url = upload_url @@ -2296,11 +2801,11 @@ class TrackedResource(Resource): :vartype name: str :ivar type: The type of the resource. :vartype type: str - :param location: The GEO location of the resource. - :type location: str - :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] + :ivar location: The GEO location of the resource. + :vartype location: str + :ivar tags: A set of tags. Tags of the service which is a list of key value pairs that describe + the resource. + :vartype tags: dict[str, str] """ _validation = { @@ -2324,6 +2829,13 @@ def __init__( tags: Optional[Dict[str, str]] = None, **kwargs ): + """ + :keyword location: The GEO location of the resource. + :paramtype location: str + :keyword tags: A set of tags. Tags of the service which is a list of key value pairs that + describe the resource. + :paramtype tags: dict[str, str] + """ super(TrackedResource, self).__init__(**kwargs) self.location = location self.tags = tags @@ -2340,15 +2852,16 @@ class ServiceResource(TrackedResource): :vartype name: str :ivar type: The type of the resource. :vartype type: str - :param location: The GEO location of the resource. - :type location: str - :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. - :type sku: ~azure.mgmt.appplatform.v2020_11_01_preview.models.Sku + :ivar location: The GEO location of the resource. + :vartype location: str + :ivar tags: A set of tags. Tags of the service which is a list of key value pairs that describe + the resource. + :vartype tags: dict[str, str] + :ivar properties: Properties of the Service resource. + :vartype properties: + ~azure.mgmt.appplatform.v2020_11_01_preview.models.ClusterResourceProperties + :ivar sku: Sku of the Service resource. + :vartype sku: ~azure.mgmt.appplatform.v2020_11_01_preview.models.Sku """ _validation = { @@ -2376,6 +2889,18 @@ def __init__( sku: Optional["Sku"] = None, **kwargs ): + """ + :keyword location: The GEO location of the resource. + :paramtype location: str + :keyword tags: A set of tags. Tags of the service which is a list of key value pairs that + describe the resource. + :paramtype tags: dict[str, str] + :keyword properties: Properties of the Service resource. + :paramtype properties: + ~azure.mgmt.appplatform.v2020_11_01_preview.models.ClusterResourceProperties + :keyword sku: Sku of the Service resource. + :paramtype sku: ~azure.mgmt.appplatform.v2020_11_01_preview.models.Sku + """ super(ServiceResource, self).__init__(location=location, tags=tags, **kwargs) self.properties = properties self.sku = sku @@ -2384,11 +2909,11 @@ def __init__( 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). + :ivar value: Collection of Service resources. + :vartype value: list[~azure.mgmt.appplatform.v2020_11_01_preview.models.ServiceResource] + :ivar 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 + :vartype next_link: str """ _attribute_map = { @@ -2403,6 +2928,13 @@ def __init__( next_link: Optional[str] = None, **kwargs ): + """ + :keyword value: Collection of Service resources. + :paramtype value: list[~azure.mgmt.appplatform.v2020_11_01_preview.models.ServiceResource] + :keyword next_link: URL client should use to fetch the next page (per server side paging). + It's null for now, added for future use. + :paramtype next_link: str + """ super(ServiceResourceList, self).__init__(**kwargs) self.value = value self.next_link = next_link @@ -2411,11 +2943,11 @@ def __init__( class ServiceSpecification(msrest.serialization.Model): """Service specification payload. - :param log_specifications: Specifications of the Log for Azure Monitoring. - :type log_specifications: + :ivar log_specifications: Specifications of the Log for Azure Monitoring. + :vartype log_specifications: list[~azure.mgmt.appplatform.v2020_11_01_preview.models.LogSpecification] - :param metric_specifications: Specifications of the Metrics for Azure Monitoring. - :type metric_specifications: + :ivar metric_specifications: Specifications of the Metrics for Azure Monitoring. + :vartype metric_specifications: list[~azure.mgmt.appplatform.v2020_11_01_preview.models.MetricSpecification] """ @@ -2431,6 +2963,14 @@ def __init__( metric_specifications: Optional[List["MetricSpecification"]] = None, **kwargs ): + """ + :keyword log_specifications: Specifications of the Log for Azure Monitoring. + :paramtype log_specifications: + list[~azure.mgmt.appplatform.v2020_11_01_preview.models.LogSpecification] + :keyword metric_specifications: Specifications of the Metrics for Azure Monitoring. + :paramtype metric_specifications: + list[~azure.mgmt.appplatform.v2020_11_01_preview.models.MetricSpecification] + """ super(ServiceSpecification, self).__init__(**kwargs) self.log_specifications = log_specifications self.metric_specifications = metric_specifications @@ -2439,12 +2979,12 @@ def __init__( class Sku(msrest.serialization.Model): """Sku of Azure Spring Cloud. - :param name: Name of the Sku. - :type name: str - :param tier: Tier of the Sku. - :type tier: str - :param capacity: Current capacity of the target resource. - :type capacity: int + :ivar name: Name of the Sku. + :vartype name: str + :ivar tier: Tier of the Sku. + :vartype tier: str + :ivar capacity: Current capacity of the target resource. + :vartype capacity: int """ _attribute_map = { @@ -2461,6 +3001,14 @@ def __init__( capacity: Optional[int] = None, **kwargs ): + """ + :keyword name: Name of the Sku. + :paramtype name: str + :keyword tier: Tier of the Sku. + :paramtype tier: str + :keyword capacity: Current capacity of the target resource. + :paramtype capacity: int + """ super(Sku, self).__init__(**kwargs) self.name = name self.tier = tier @@ -2472,15 +3020,15 @@ class SkuCapacity(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param minimum: Required. Gets or sets the minimum. - :type minimum: int - :param maximum: Gets or sets the maximum. - :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", + :ivar minimum: Required. Gets or sets the minimum. + :vartype minimum: int + :ivar maximum: Gets or sets the maximum. + :vartype maximum: int + :ivar default: Gets or sets the default. + :vartype default: int + :ivar 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 + :vartype scale_type: str or ~azure.mgmt.appplatform.v2020_11_01_preview.models.SkuScaleType """ _validation = { @@ -2503,6 +3051,17 @@ def __init__( scale_type: Optional[Union[str, "SkuScaleType"]] = None, **kwargs ): + """ + :keyword minimum: Required. Gets or sets the minimum. + :paramtype minimum: int + :keyword maximum: Gets or sets the maximum. + :paramtype maximum: int + :keyword default: Gets or sets the default. + :paramtype default: int + :keyword scale_type: Gets or sets the type of the scale. Possible values include: "None", + "Manual", "Automatic". + :paramtype scale_type: str or ~azure.mgmt.appplatform.v2020_11_01_preview.models.SkuScaleType + """ super(SkuCapacity, self).__init__(**kwargs) self.minimum = minimum self.maximum = maximum @@ -2513,15 +3072,15 @@ def __init__( 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"). + :ivar value: The raw value which could be passed to deployment CRUD operations. Possible values + include: "Java_8", "Java_11", "NetCore_31". + :vartype value: str or ~azure.mgmt.appplatform.v2020_11_01_preview.models.SupportedRuntimeValue + :ivar platform: The platform of this runtime version (possible values: "Java" or ".NET"). Possible values include: "Java", ".NET Core". - :type platform: str or + :vartype platform: str or ~azure.mgmt.appplatform.v2020_11_01_preview.models.SupportedRuntimePlatform - :param version: The detailed version (major.minor) of the platform. - :type version: str + :ivar version: The detailed version (major.minor) of the platform. + :vartype version: str """ _attribute_map = { @@ -2538,6 +3097,18 @@ def __init__( version: Optional[str] = None, **kwargs ): + """ + :keyword value: The raw value which could be passed to deployment CRUD operations. Possible + values include: "Java_8", "Java_11", "NetCore_31". + :paramtype value: str or + ~azure.mgmt.appplatform.v2020_11_01_preview.models.SupportedRuntimeValue + :keyword platform: The platform of this runtime version (possible values: "Java" or ".NET"). + Possible values include: "Java", ".NET Core". + :paramtype platform: str or + ~azure.mgmt.appplatform.v2020_11_01_preview.models.SupportedRuntimePlatform + :keyword version: The detailed version (major.minor) of the platform. + :paramtype version: str + """ super(SupportedRuntimeVersion, self).__init__(**kwargs) self.value = value self.platform = platform @@ -2547,10 +3118,10 @@ def __init__( class TemporaryDisk(msrest.serialization.Model): """Temporary disk payload. - :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. - :type mount_path: str + :ivar size_in_gb: Size of the temporary disk in GB. + :vartype size_in_gb: int + :ivar mount_path: Mount path of the temporary disk. + :vartype mount_path: str """ _validation = { @@ -2569,6 +3140,12 @@ def __init__( mount_path: Optional[str] = "/tmp", **kwargs ): + """ + :keyword size_in_gb: Size of the temporary disk in GB. + :paramtype size_in_gb: int + :keyword mount_path: Mount path of the temporary disk. + :paramtype mount_path: str + """ super(TemporaryDisk, self).__init__(**kwargs) self.size_in_gb = size_in_gb self.mount_path = mount_path @@ -2577,16 +3154,16 @@ def __init__( class TestKeys(msrest.serialization.Model): """Test keys payload. - :param primary_key: Primary key. - :type primary_key: str - :param secondary_key: Secondary key. - :type secondary_key: str - :param primary_test_endpoint: Primary test endpoint. - :type primary_test_endpoint: str - :param secondary_test_endpoint: Secondary test endpoint. - :type secondary_test_endpoint: str - :param enabled: Indicates whether the test endpoint feature enabled or not. - :type enabled: bool + :ivar primary_key: Primary key. + :vartype primary_key: str + :ivar secondary_key: Secondary key. + :vartype secondary_key: str + :ivar primary_test_endpoint: Primary test endpoint. + :vartype primary_test_endpoint: str + :ivar secondary_test_endpoint: Secondary test endpoint. + :vartype secondary_test_endpoint: str + :ivar enabled: Indicates whether the test endpoint feature enabled or not. + :vartype enabled: bool """ _attribute_map = { @@ -2607,6 +3184,18 @@ def __init__( enabled: Optional[bool] = None, **kwargs ): + """ + :keyword primary_key: Primary key. + :paramtype primary_key: str + :keyword secondary_key: Secondary key. + :paramtype secondary_key: str + :keyword primary_test_endpoint: Primary test endpoint. + :paramtype primary_test_endpoint: str + :keyword secondary_test_endpoint: Secondary test endpoint. + :paramtype secondary_test_endpoint: str + :keyword enabled: Indicates whether the test endpoint feature enabled or not. + :paramtype enabled: bool + """ super(TestKeys, self).__init__(**kwargs) self.primary_key = primary_key self.secondary_key = secondary_key @@ -2618,17 +3207,17 @@ def __init__( class UserSourceInfo(msrest.serialization.Model): """Source information for a deployment. - :param type: Type of the source uploaded. Possible values include: "Jar", "NetCoreZip", + :ivar 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. - :type version: str - :param artifact_selector: Selector for the artifact to be used for the deployment for + :vartype type: str or ~azure.mgmt.appplatform.v2020_11_01_preview.models.UserSourceType + :ivar relative_path: Relative path of the storage which stores the source. + :vartype relative_path: str + :ivar version: Version of the source. + :vartype version: str + :ivar 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 + :vartype artifact_selector: str """ _attribute_map = { @@ -2647,6 +3236,19 @@ def __init__( artifact_selector: Optional[str] = None, **kwargs ): + """ + :keyword type: Type of the source uploaded. Possible values include: "Jar", "NetCoreZip", + "Source". + :paramtype type: str or ~azure.mgmt.appplatform.v2020_11_01_preview.models.UserSourceType + :keyword relative_path: Relative path of the storage which stores the source. + :paramtype relative_path: str + :keyword version: Version of the source. + :paramtype version: str + :keyword 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. + :paramtype artifact_selector: str + """ super(UserSourceInfo, self).__init__(**kwargs) self.type = type self.relative_path = relative_path diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2020_11_01_preview/operations/_apps_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2020_11_01_preview/operations/_apps_operations.py index 2b9bcb3d68bdf..3e560f4de0919 100644 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2020_11_01_preview/operations/_apps_operations.py +++ b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2020_11_01_preview/operations/_apps_operations.py @@ -5,26 +5,314 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools from typing import TYPE_CHECKING import warnings 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.pipeline.transport import HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling +from msrest import Serializer from .. import models as _models +from .._vendor import _convert_request, _format_url_section 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]] +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False +# fmt: off + +def build_get_request( + subscription_id, # type: str + resource_group_name, # type: str + service_name, # type: str + app_name, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + sync_status = kwargs.pop('sync_status', None) # type: Optional[str] + + api_version = "2020-11-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), + "appName": _SERIALIZER.url("app_name", app_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + if sync_status is not None: + query_parameters['syncStatus'] = _SERIALIZER.query("sync_status", sync_status, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_create_or_update_request_initial( + subscription_id, # type: str + resource_group_name, # type: str + service_name, # type: str + app_name, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2020-11-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), + "appName": _SERIALIZER.url("app_name", app_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_delete_request_initial( + subscription_id, # type: str + resource_group_name, # type: str + service_name, # type: str + app_name, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + api_version = "2020-11-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), + "appName": _SERIALIZER.url("app_name", app_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="DELETE", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_update_request_initial( + subscription_id, # type: str + resource_group_name, # type: str + service_name, # type: str + app_name, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2020-11-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), + "appName": _SERIALIZER.url("app_name", app_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PATCH", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_list_request( + subscription_id, # type: str + resource_group_name, # type: str + service_name, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + api_version = "2020-11-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_get_resource_upload_url_request( + subscription_id, # type: str + resource_group_name, # type: str + service_name, # type: str + app_name, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + api_version = "2020-11-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/getResourceUploadUrl') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), + "appName": _SERIALIZER.url("app_name", app_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_validate_domain_request( + subscription_id, # type: str + resource_group_name, # type: str + service_name, # type: str + app_name, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2020-11-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/validateDomain') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), + "appName": _SERIALIZER.url("app_name", app_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + +# fmt: on class AppsOperations(object): """AppsOperations operations. @@ -47,6 +335,7 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def get( self, resource_group_name, # type: str @@ -77,30 +366,19 @@ def get( 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 = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + sync_status=sync_status, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -114,8 +392,10 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized + 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, # type: str @@ -130,33 +410,23 @@ def _create_or_update_initial( 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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = self._serialize.body(app_resource, 'AppResource') + + request = build_create_or_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -177,8 +447,11 @@ def _create_or_update_initial( 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 + + @distributed_trace def begin_create_or_update( self, resource_group_name, # type: str @@ -201,15 +474,20 @@ def begin_create_or_update( :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. + :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: + :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 """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.AppResource"] lro_delay = kwargs.pop( 'polling_interval', @@ -222,28 +500,21 @@ def begin_create_or_update( service_name=service_name, app_name=app_name, app_resource=app_resource, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_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 = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -255,6 +526,7 @@ def get_long_running_output(pipeline_response): ) 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( @@ -270,28 +542,18 @@ def _delete_initial( 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 = build_delete_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -304,6 +566,8 @@ def _delete_initial( _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}'} # type: ignore + + @distributed_trace def begin_delete( self, resource_group_name, # type: str @@ -323,15 +587,17 @@ def begin_delete( :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 ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :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. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -346,22 +612,14 @@ def begin_delete( 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 = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -373,6 +631,7 @@ def get_long_running_output(pipeline_response): ) 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( @@ -389,33 +648,23 @@ def _update_initial( 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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(app_resource, 'AppResource') - # 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') + request = build_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + content_type=content_type, + json=_json, + template_url=self._update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -433,8 +682,11 @@ def _update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}'} # type: ignore + + @distributed_trace def begin_update( self, resource_group_name, # type: str @@ -457,15 +709,20 @@ def begin_update( :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. + :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: + :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 """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.AppResource"] lro_delay = kwargs.pop( 'polling_interval', @@ -478,28 +735,21 @@ def begin_update( service_name=service_name, app_name=app_name, app_resource=app_resource, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_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 = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -511,8 +761,10 @@ def get_long_running_output(pipeline_response): ) 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 + @distributed_trace def list( self, resource_group_name, # type: str @@ -528,8 +780,10 @@ def list( :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.paging.ItemPaged[~azure.mgmt.appplatform.v2020_11_01_preview.models.AppResourceCollection] + :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"] @@ -537,36 +791,33 @@ def list( 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) + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('AppResourceCollection', pipeline_response) + deserialized = self._deserialize("AppResourceCollection", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -584,11 +835,13 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps'} # type: ignore + @distributed_trace def get_resource_upload_url( self, resource_group_name, # type: str @@ -616,28 +869,18 @@ def get_resource_upload_url( 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 = build_get_resource_upload_url_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + template_url=self.get_resource_upload_url.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -651,8 +894,11 @@ def get_resource_upload_url( 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 + + @distributed_trace def validate_domain( self, resource_group_name, # type: str @@ -672,7 +918,8 @@ def validate_domain( :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 + :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 @@ -683,33 +930,23 @@ def validate_domain( 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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(validate_payload, 'CustomDomainValidatePayload') - # 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') + request = build_validate_domain_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + content_type=content_type, + json=_json, + template_url=self.validate_domain.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -723,4 +960,6 @@ def validate_domain( 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/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2020_11_01_preview/operations/_bindings_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2020_11_01_preview/operations/_bindings_operations.py index d2d143d857240..ecf6140324dc3 100644 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2020_11_01_preview/operations/_bindings_operations.py +++ b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2020_11_01_preview/operations/_bindings_operations.py @@ -5,26 +5,240 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools from typing import TYPE_CHECKING import warnings 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.pipeline.transport import HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling +from msrest import Serializer from .. import models as _models +from .._vendor import _convert_request, _format_url_section 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]] +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False +# fmt: off + +def build_get_request( + subscription_id, # type: str + resource_group_name, # type: str + service_name, # type: str + app_name, # type: str + binding_name, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + api_version = "2020-11-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/bindings/{bindingName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), + "appName": _SERIALIZER.url("app_name", app_name, 'str'), + "bindingName": _SERIALIZER.url("binding_name", binding_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_create_or_update_request_initial( + subscription_id, # type: str + resource_group_name, # type: str + service_name, # type: str + app_name, # type: str + binding_name, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2020-11-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/bindings/{bindingName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), + "appName": _SERIALIZER.url("app_name", app_name, 'str'), + "bindingName": _SERIALIZER.url("binding_name", binding_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_delete_request_initial( + subscription_id, # type: str + resource_group_name, # type: str + service_name, # type: str + app_name, # type: str + binding_name, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + api_version = "2020-11-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/bindings/{bindingName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), + "appName": _SERIALIZER.url("app_name", app_name, 'str'), + "bindingName": _SERIALIZER.url("binding_name", binding_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="DELETE", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_update_request_initial( + subscription_id, # type: str + resource_group_name, # type: str + service_name, # type: str + app_name, # type: str + binding_name, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2020-11-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/bindings/{bindingName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), + "appName": _SERIALIZER.url("app_name", app_name, 'str'), + "bindingName": _SERIALIZER.url("binding_name", binding_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PATCH", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_list_request( + subscription_id, # type: str + resource_group_name, # type: str + service_name, # type: str + app_name, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + api_version = "2020-11-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/bindings') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), + "appName": _SERIALIZER.url("app_name", app_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + +# fmt: on class BindingsOperations(object): """BindingsOperations operations. @@ -47,6 +261,7 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def get( self, resource_group_name, # type: str @@ -77,29 +292,19 @@ def get( 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 = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + binding_name=binding_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -113,8 +318,10 @@ def get( 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 + def _create_or_update_initial( self, resource_group_name, # type: str @@ -130,34 +337,24 @@ def _create_or_update_initial( 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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = self._serialize.body(binding_resource, 'BindingResource') + + request = build_create_or_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + binding_name=binding_name, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -178,8 +375,11 @@ def _create_or_update_initial( 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 + + @distributed_trace def begin_create_or_update( self, resource_group_name, # type: str @@ -205,15 +405,20 @@ def begin_create_or_update( :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. + :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: + :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 """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.BindingResource"] lro_delay = kwargs.pop( 'polling_interval', @@ -227,29 +432,21 @@ def begin_create_or_update( app_name=app_name, binding_name=binding_name, binding_resource=binding_resource, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_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 = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -261,6 +458,7 @@ def get_long_running_output(pipeline_response): ) 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( @@ -277,29 +475,19 @@ def _delete_initial( 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 = build_delete_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + binding_name=binding_name, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -312,6 +500,8 @@ def _delete_initial( _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/bindings/{bindingName}'} # type: ignore + + @distributed_trace def begin_delete( self, resource_group_name, # type: str @@ -334,15 +524,17 @@ def begin_delete( :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 ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :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. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -358,23 +550,14 @@ def begin_delete( 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 = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -386,6 +569,7 @@ def get_long_running_output(pipeline_response): ) 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( @@ -403,34 +587,24 @@ def _update_initial( 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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(binding_resource, 'BindingResource') - # 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') + request = build_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + binding_name=binding_name, + content_type=content_type, + json=_json, + template_url=self._update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -448,8 +622,11 @@ def _update_initial( 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 + + @distributed_trace def begin_update( self, resource_group_name, # type: str @@ -475,15 +652,20 @@ def begin_update( :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. + :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: + :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 """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.BindingResource"] lro_delay = kwargs.pop( 'polling_interval', @@ -497,29 +679,21 @@ def begin_update( app_name=app_name, binding_name=binding_name, binding_resource=binding_resource, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_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 = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -531,8 +705,10 @@ def get_long_running_output(pipeline_response): ) 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 + @distributed_trace def list( self, resource_group_name, # type: str @@ -551,8 +727,10 @@ def list( :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.paging.ItemPaged[~azure.mgmt.appplatform.v2020_11_01_preview.models.BindingResourceCollection] + :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"] @@ -560,37 +738,35 @@ def list( 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) + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('BindingResourceCollection', pipeline_response) + deserialized = self._deserialize("BindingResourceCollection", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -608,6 +784,7 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2020_11_01_preview/operations/_certificates_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2020_11_01_preview/operations/_certificates_operations.py index 0dbefc75ad9b1..86222397c632f 100644 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2020_11_01_preview/operations/_certificates_operations.py +++ b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2020_11_01_preview/operations/_certificates_operations.py @@ -5,26 +5,188 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools from typing import TYPE_CHECKING import warnings 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.pipeline.transport import HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling +from msrest import Serializer from .. import models as _models +from .._vendor import _convert_request, _format_url_section 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]] +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False +# fmt: off + +def build_get_request( + subscription_id, # type: str + resource_group_name, # type: str + service_name, # type: str + certificate_name, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + api_version = "2020-11-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/certificates/{certificateName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), + "certificateName": _SERIALIZER.url("certificate_name", certificate_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_create_or_update_request_initial( + subscription_id, # type: str + resource_group_name, # type: str + service_name, # type: str + certificate_name, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2020-11-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/certificates/{certificateName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), + "certificateName": _SERIALIZER.url("certificate_name", certificate_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_delete_request_initial( + subscription_id, # type: str + resource_group_name, # type: str + service_name, # type: str + certificate_name, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + api_version = "2020-11-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/certificates/{certificateName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), + "certificateName": _SERIALIZER.url("certificate_name", certificate_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="DELETE", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_list_request( + subscription_id, # type: str + resource_group_name, # type: str + service_name, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + api_version = "2020-11-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/certificates') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + +# fmt: on class CertificatesOperations(object): """CertificatesOperations operations. @@ -47,6 +209,7 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def get( self, resource_group_name, # type: str @@ -74,28 +237,18 @@ def get( 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 = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + certificate_name=certificate_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -109,8 +262,10 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized + 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, # type: str @@ -125,33 +280,23 @@ def _create_or_update_initial( 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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = self._serialize.body(certificate_resource, 'CertificateResource') + + request = build_create_or_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + certificate_name=certificate_name, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -172,8 +317,11 @@ def _create_or_update_initial( 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 + + @distributed_trace def begin_create_or_update( self, resource_group_name, # type: str @@ -193,18 +341,24 @@ def begin_create_or_update( :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 + :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. + :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: + :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 """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.CertificateResource"] lro_delay = kwargs.pop( 'polling_interval', @@ -217,28 +371,21 @@ def begin_create_or_update( service_name=service_name, certificate_name=certificate_name, certificate_resource=certificate_resource, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_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 = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -250,6 +397,7 @@ def get_long_running_output(pipeline_response): ) 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( @@ -265,28 +413,18 @@ def _delete_initial( 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 = build_delete_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + certificate_name=certificate_name, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -299,6 +437,8 @@ def _delete_initial( _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/certificates/{certificateName}'} # type: ignore + + @distributed_trace def begin_delete( self, resource_group_name, # type: str @@ -318,15 +458,17 @@ def begin_delete( :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 ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :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. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -341,22 +483,14 @@ def begin_delete( 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 = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -368,8 +502,10 @@ def get_long_running_output(pipeline_response): ) 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 + @distributed_trace def list( self, resource_group_name, # type: str @@ -385,8 +521,10 @@ def list( :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.paging.ItemPaged[~azure.mgmt.appplatform.v2020_11_01_preview.models.CertificateResourceCollection] + :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"] @@ -394,36 +532,33 @@ def list( 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) + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('CertificateResourceCollection', pipeline_response) + deserialized = self._deserialize("CertificateResourceCollection", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -441,6 +576,7 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2020_11_01_preview/operations/_config_servers_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2020_11_01_preview/operations/_config_servers_operations.py index dd9d73e3d8a53..85fd1ae8b81b4 100644 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2020_11_01_preview/operations/_config_servers_operations.py +++ b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2020_11_01_preview/operations/_config_servers_operations.py @@ -5,25 +5,189 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools from typing import TYPE_CHECKING 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 HttpRequest, HttpResponse +from azure.core.pipeline.transport import HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling +from msrest import Serializer from .. import models as _models +from .._vendor import _convert_request, _format_url_section 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]] +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False +# fmt: off + +def build_get_request( + subscription_id, # type: str + resource_group_name, # type: str + service_name, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + api_version = "2020-11-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configServers/default') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_update_put_request_initial( + subscription_id, # type: str + resource_group_name, # type: str + service_name, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2020-11-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configServers/default') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_update_patch_request_initial( + subscription_id, # type: str + resource_group_name, # type: str + service_name, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2020-11-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configServers/default') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PATCH", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_validate_request_initial( + subscription_id, # type: str + resource_group_name, # type: str + service_name, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2020-11-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configServers/validate') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + +# fmt: on class ConfigServersOperations(object): """ConfigServersOperations operations. @@ -46,6 +210,7 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def get( self, resource_group_name, # type: str @@ -70,27 +235,17 @@ def get( 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 = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -104,8 +259,10 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configServers/default'} # type: ignore + def _update_put_initial( self, resource_group_name, # type: str @@ -119,32 +276,22 @@ def _update_put_initial( 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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = self._serialize.body(config_server_resource, 'ConfigServerResource') + + request = build_update_put_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + content_type=content_type, + json=_json, + template_url=self._update_put_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -162,8 +309,11 @@ def _update_put_initial( 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 + + @distributed_trace def begin_update_put( self, resource_group_name, # type: str @@ -180,18 +330,24 @@ def begin_update_put( :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 + :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. + :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: + :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 """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.ConfigServerResource"] lro_delay = kwargs.pop( 'polling_interval', @@ -203,27 +359,21 @@ def begin_update_put( resource_group_name=resource_group_name, service_name=service_name, config_server_resource=config_server_resource, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_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 = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -235,6 +385,7 @@ def get_long_running_output(pipeline_response): ) 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( @@ -250,32 +401,22 @@ def _update_patch_initial( 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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(config_server_resource, 'ConfigServerResource') - # 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') + request = build_update_patch_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + content_type=content_type, + json=_json, + template_url=self._update_patch_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -293,8 +434,11 @@ def _update_patch_initial( 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 + + @distributed_trace def begin_update_patch( self, resource_group_name, # type: str @@ -311,18 +455,24 @@ def begin_update_patch( :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 + :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. + :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: + :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 """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.ConfigServerResource"] lro_delay = kwargs.pop( 'polling_interval', @@ -334,27 +484,21 @@ def begin_update_patch( resource_group_name=resource_group_name, service_name=service_name, config_server_resource=config_server_resource, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_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 = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -366,6 +510,7 @@ def get_long_running_output(pipeline_response): ) 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( @@ -381,32 +526,22 @@ def _validate_initial( 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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = self._serialize.body(config_server_settings, 'ConfigServerSettings') + + request = build_validate_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + content_type=content_type, + json=_json, + template_url=self._validate_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -424,8 +559,11 @@ def _validate_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _validate_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configServers/validate'} # type: ignore + + @distributed_trace def begin_validate( self, resource_group_name, # type: str @@ -442,18 +580,24 @@ def begin_validate( :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 + :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. + :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: + :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 """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.ConfigServerSettingsValidateResult"] lro_delay = kwargs.pop( 'polling_interval', @@ -465,27 +609,21 @@ def begin_validate( resource_group_name=resource_group_name, service_name=service_name, config_server_settings=config_server_settings, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_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 = ARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -497,4 +635,5 @@ def get_long_running_output(pipeline_response): ) 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/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2020_11_01_preview/operations/_custom_domains_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2020_11_01_preview/operations/_custom_domains_operations.py index 9981f525763ca..6bd1eac43c8fa 100644 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2020_11_01_preview/operations/_custom_domains_operations.py +++ b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2020_11_01_preview/operations/_custom_domains_operations.py @@ -5,26 +5,240 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools from typing import TYPE_CHECKING import warnings 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.pipeline.transport import HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling +from msrest import Serializer from .. import models as _models +from .._vendor import _convert_request, _format_url_section 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]] +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False +# fmt: off + +def build_get_request( + subscription_id, # type: str + resource_group_name, # type: str + service_name, # type: str + app_name, # type: str + domain_name, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + api_version = "2020-11-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/domains/{domainName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), + "appName": _SERIALIZER.url("app_name", app_name, 'str'), + "domainName": _SERIALIZER.url("domain_name", domain_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_create_or_update_request_initial( + subscription_id, # type: str + resource_group_name, # type: str + service_name, # type: str + app_name, # type: str + domain_name, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2020-11-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/domains/{domainName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), + "appName": _SERIALIZER.url("app_name", app_name, 'str'), + "domainName": _SERIALIZER.url("domain_name", domain_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_delete_request_initial( + subscription_id, # type: str + resource_group_name, # type: str + service_name, # type: str + app_name, # type: str + domain_name, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + api_version = "2020-11-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/domains/{domainName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), + "appName": _SERIALIZER.url("app_name", app_name, 'str'), + "domainName": _SERIALIZER.url("domain_name", domain_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="DELETE", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_update_request_initial( + subscription_id, # type: str + resource_group_name, # type: str + service_name, # type: str + app_name, # type: str + domain_name, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2020-11-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/domains/{domainName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), + "appName": _SERIALIZER.url("app_name", app_name, 'str'), + "domainName": _SERIALIZER.url("domain_name", domain_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PATCH", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_list_request( + subscription_id, # type: str + resource_group_name, # type: str + service_name, # type: str + app_name, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + api_version = "2020-11-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/domains') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), + "appName": _SERIALIZER.url("app_name", app_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + +# fmt: on class CustomDomainsOperations(object): """CustomDomainsOperations operations. @@ -47,6 +261,7 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def get( self, resource_group_name, # type: str @@ -77,29 +292,19 @@ def get( 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 = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + domain_name=domain_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -113,8 +318,10 @@ def get( 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 + def _create_or_update_initial( self, resource_group_name, # type: str @@ -130,34 +337,24 @@ def _create_or_update_initial( 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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = self._serialize.body(domain_resource, 'CustomDomainResource') + + request = build_create_or_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + domain_name=domain_name, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -178,8 +375,11 @@ def _create_or_update_initial( 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 + + @distributed_trace def begin_create_or_update( self, resource_group_name, # type: str @@ -205,15 +405,20 @@ def begin_create_or_update( :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. + :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: + :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 """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.CustomDomainResource"] lro_delay = kwargs.pop( 'polling_interval', @@ -227,29 +432,21 @@ def begin_create_or_update( app_name=app_name, domain_name=domain_name, domain_resource=domain_resource, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_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 = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -261,6 +458,7 @@ def get_long_running_output(pipeline_response): ) 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( @@ -277,29 +475,19 @@ def _delete_initial( 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 = build_delete_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + domain_name=domain_name, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -312,6 +500,8 @@ def _delete_initial( _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/domains/{domainName}'} # type: ignore + + @distributed_trace def begin_delete( self, resource_group_name, # type: str @@ -334,15 +524,17 @@ def begin_delete( :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 ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :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. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -358,23 +550,14 @@ def begin_delete( 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 = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -386,6 +569,7 @@ def get_long_running_output(pipeline_response): ) 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( @@ -403,34 +587,24 @@ def _update_initial( 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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(domain_resource, 'CustomDomainResource') - # 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') + request = build_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + domain_name=domain_name, + content_type=content_type, + json=_json, + template_url=self._update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -448,8 +622,11 @@ def _update_initial( 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 + + @distributed_trace def begin_update( self, resource_group_name, # type: str @@ -475,15 +652,20 @@ def begin_update( :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. + :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: + :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 """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.CustomDomainResource"] lro_delay = kwargs.pop( 'polling_interval', @@ -497,29 +679,21 @@ def begin_update( app_name=app_name, domain_name=domain_name, domain_resource=domain_resource, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_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 = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -531,8 +705,10 @@ def get_long_running_output(pipeline_response): ) 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 + @distributed_trace def list( self, resource_group_name, # type: str @@ -551,8 +727,10 @@ def list( :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.paging.ItemPaged[~azure.mgmt.appplatform.v2020_11_01_preview.models.CustomDomainResourceCollection] + :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"] @@ -560,37 +738,35 @@ def list( 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) + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('CustomDomainResourceCollection', pipeline_response) + deserialized = self._deserialize("CustomDomainResourceCollection", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -608,6 +784,7 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2020_11_01_preview/operations/_deployments_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2020_11_01_preview/operations/_deployments_operations.py index d88630d968946..50a741ae88fb2 100644 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2020_11_01_preview/operations/_deployments_operations.py +++ b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2020_11_01_preview/operations/_deployments_operations.py @@ -5,26 +5,444 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools from typing import TYPE_CHECKING import warnings 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.pipeline.transport import HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling +from msrest import Serializer from .. import models as _models +from .._vendor import _convert_request, _format_url_section 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]] +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False +# fmt: off + +def build_get_request( + subscription_id, # type: str + resource_group_name, # type: str + service_name, # type: str + app_name, # type: str + deployment_name, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + api_version = "2020-11-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), + "appName": _SERIALIZER.url("app_name", app_name, 'str'), + "deploymentName": _SERIALIZER.url("deployment_name", deployment_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_create_or_update_request_initial( + subscription_id, # type: str + resource_group_name, # type: str + service_name, # type: str + app_name, # type: str + deployment_name, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2020-11-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), + "appName": _SERIALIZER.url("app_name", app_name, 'str'), + "deploymentName": _SERIALIZER.url("deployment_name", deployment_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_delete_request_initial( + subscription_id, # type: str + resource_group_name, # type: str + service_name, # type: str + app_name, # type: str + deployment_name, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + api_version = "2020-11-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), + "appName": _SERIALIZER.url("app_name", app_name, 'str'), + "deploymentName": _SERIALIZER.url("deployment_name", deployment_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="DELETE", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_update_request_initial( + subscription_id, # type: str + resource_group_name, # type: str + service_name, # type: str + app_name, # type: str + deployment_name, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2020-11-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), + "appName": _SERIALIZER.url("app_name", app_name, 'str'), + "deploymentName": _SERIALIZER.url("deployment_name", deployment_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PATCH", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_list_request( + subscription_id, # type: str + resource_group_name, # type: str + service_name, # type: str + app_name, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + version = kwargs.pop('version', None) # type: Optional[List[str]] + + api_version = "2020-11-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), + "appName": _SERIALIZER.url("app_name", app_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + if version is not None: + query_parameters['version'] = [_SERIALIZER.query("version", q, 'str') if q is not None else '' for q in version] + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_list_for_cluster_request( + subscription_id, # type: str + resource_group_name, # type: str + service_name, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + version = kwargs.pop('version', None) # type: Optional[List[str]] + + api_version = "2020-11-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/deployments') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + if version is not None: + query_parameters['version'] = [_SERIALIZER.query("version", q, 'str') if q is not None else '' for q in version] + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_start_request_initial( + subscription_id, # type: str + resource_group_name, # type: str + service_name, # type: str + app_name, # type: str + deployment_name, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + api_version = "2020-11-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/start') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), + "appName": _SERIALIZER.url("app_name", app_name, 'str'), + "deploymentName": _SERIALIZER.url("deployment_name", deployment_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_stop_request_initial( + subscription_id, # type: str + resource_group_name, # type: str + service_name, # type: str + app_name, # type: str + deployment_name, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + api_version = "2020-11-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/stop') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), + "appName": _SERIALIZER.url("app_name", app_name, 'str'), + "deploymentName": _SERIALIZER.url("deployment_name", deployment_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_restart_request_initial( + subscription_id, # type: str + resource_group_name, # type: str + service_name, # type: str + app_name, # type: str + deployment_name, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + api_version = "2020-11-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/restart') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), + "appName": _SERIALIZER.url("app_name", app_name, 'str'), + "deploymentName": _SERIALIZER.url("deployment_name", deployment_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_get_log_file_url_request( + subscription_id, # type: str + resource_group_name, # type: str + service_name, # type: str + app_name, # type: str + deployment_name, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + api_version = "2020-11-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/getLogFileUrl') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), + "appName": _SERIALIZER.url("app_name", app_name, 'str'), + "deploymentName": _SERIALIZER.url("deployment_name", deployment_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + +# fmt: on class DeploymentsOperations(object): """DeploymentsOperations operations. @@ -47,6 +465,7 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def get( self, resource_group_name, # type: str @@ -77,29 +496,19 @@ def get( 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 = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + deployment_name=deployment_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -113,8 +522,10 @@ def get( 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 + def _create_or_update_initial( self, resource_group_name, # type: str @@ -130,34 +541,24 @@ def _create_or_update_initial( 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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = self._serialize.body(deployment_resource, 'DeploymentResource') + + request = build_create_or_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + deployment_name=deployment_name, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -178,8 +579,11 @@ def _create_or_update_initial( 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 + + @distributed_trace def begin_create_or_update( self, resource_group_name, # type: str @@ -202,18 +606,24 @@ def begin_create_or_update( :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 + :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. + :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: + :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 """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.DeploymentResource"] lro_delay = kwargs.pop( 'polling_interval', @@ -227,29 +637,21 @@ def begin_create_or_update( app_name=app_name, deployment_name=deployment_name, deployment_resource=deployment_resource, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_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 = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -261,6 +663,7 @@ def get_long_running_output(pipeline_response): ) 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( @@ -277,29 +680,19 @@ def _delete_initial( 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 = build_delete_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + deployment_name=deployment_name, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -312,6 +705,8 @@ def _delete_initial( _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}'} # type: ignore + + @distributed_trace def begin_delete( self, resource_group_name, # type: str @@ -334,15 +729,17 @@ def begin_delete( :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 ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :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. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -358,23 +755,14 @@ def begin_delete( 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 = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -386,6 +774,7 @@ def get_long_running_output(pipeline_response): ) 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( @@ -403,34 +792,24 @@ def _update_initial( 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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = self._serialize.body(deployment_resource, 'DeploymentResource') + + request = build_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + deployment_name=deployment_name, + content_type=content_type, + json=_json, + template_url=self._update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -448,8 +827,11 @@ def _update_initial( 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 + + @distributed_trace def begin_update( self, resource_group_name, # type: str @@ -472,18 +854,24 @@ def begin_update( :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 + :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. + :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: + :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 """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.DeploymentResource"] lro_delay = kwargs.pop( 'polling_interval', @@ -497,29 +885,21 @@ def begin_update( app_name=app_name, deployment_name=deployment_name, deployment_resource=deployment_resource, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_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 = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -531,8 +911,10 @@ def get_long_running_output(pipeline_response): ) 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 + @distributed_trace def list( self, resource_group_name, # type: str @@ -554,8 +936,10 @@ def list( :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.paging.ItemPaged[~azure.mgmt.appplatform.v2020_11_01_preview.models.DeploymentResourceCollection] + :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"] @@ -563,39 +947,37 @@ def list( 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) + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + version=version, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + version=version, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('DeploymentResourceCollection', pipeline_response) + deserialized = self._deserialize("DeploymentResourceCollection", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -613,11 +995,13 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments'} # type: ignore + @distributed_trace def list_for_cluster( self, resource_group_name, # type: str @@ -636,8 +1020,10 @@ def list_for_cluster( :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.paging.ItemPaged[~azure.mgmt.appplatform.v2020_11_01_preview.models.DeploymentResourceCollection] + :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"] @@ -645,38 +1031,35 @@ def list_for_cluster( 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) + + request = build_list_for_cluster_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + version=version, + template_url=self.list_for_cluster.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_for_cluster_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + version=version, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('DeploymentResourceCollection', pipeline_response) + deserialized = self._deserialize("DeploymentResourceCollection", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -694,6 +1077,7 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) @@ -713,29 +1097,19 @@ def _start_initial( 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 = build_start_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + deployment_name=deployment_name, + template_url=self._start_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -748,6 +1122,8 @@ def _start_initial( _start_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/start'} # type: ignore + + @distributed_trace def begin_start( self, resource_group_name, # type: str @@ -770,15 +1146,17 @@ def begin_start( :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 ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :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. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -794,23 +1172,14 @@ def begin_start( 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 = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -822,6 +1191,7 @@ def get_long_running_output(pipeline_response): ) 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( @@ -838,29 +1208,19 @@ def _stop_initial( 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 = build_stop_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + deployment_name=deployment_name, + template_url=self._stop_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -873,6 +1233,8 @@ def _stop_initial( _stop_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/stop'} # type: ignore + + @distributed_trace def begin_stop( self, resource_group_name, # type: str @@ -895,15 +1257,17 @@ def begin_stop( :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 ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :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. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -919,23 +1283,14 @@ def begin_stop( 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 = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -947,6 +1302,7 @@ def get_long_running_output(pipeline_response): ) 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( @@ -963,29 +1319,19 @@ def _restart_initial( 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 = build_restart_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + deployment_name=deployment_name, + template_url=self._restart_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -998,6 +1344,8 @@ def _restart_initial( _restart_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/restart'} # type: ignore + + @distributed_trace def begin_restart( self, resource_group_name, # type: str @@ -1020,15 +1368,17 @@ def begin_restart( :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 ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :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. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -1044,23 +1394,14 @@ def begin_restart( 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 = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -1072,8 +1413,10 @@ def get_long_running_output(pipeline_response): ) 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 + @distributed_trace def get_log_file_url( self, resource_group_name, # type: str @@ -1104,29 +1447,19 @@ def get_log_file_url( 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 = build_get_log_file_url_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + deployment_name=deployment_name, + template_url=self.get_log_file_url.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -1142,4 +1475,6 @@ def get_log_file_url( 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/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2020_11_01_preview/operations/_monitoring_settings_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2020_11_01_preview/operations/_monitoring_settings_operations.py index a7544e77b785e..39334bb244cc7 100644 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2020_11_01_preview/operations/_monitoring_settings_operations.py +++ b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2020_11_01_preview/operations/_monitoring_settings_operations.py @@ -5,25 +5,149 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools from typing import TYPE_CHECKING 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 HttpRequest, HttpResponse +from azure.core.pipeline.transport import HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling +from msrest import Serializer from .. import models as _models +from .._vendor import _convert_request, _format_url_section 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]] +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False +# fmt: off + +def build_get_request( + subscription_id, # type: str + resource_group_name, # type: str + service_name, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + api_version = "2020-11-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/monitoringSettings/default') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_update_put_request_initial( + subscription_id, # type: str + resource_group_name, # type: str + service_name, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2020-11-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/monitoringSettings/default') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_update_patch_request_initial( + subscription_id, # type: str + resource_group_name, # type: str + service_name, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2020-11-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/monitoringSettings/default') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PATCH", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + +# fmt: on class MonitoringSettingsOperations(object): """MonitoringSettingsOperations operations. @@ -46,6 +170,7 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def get( self, resource_group_name, # type: str @@ -70,27 +195,17 @@ def get( 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 = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -104,8 +219,10 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/monitoringSettings/default'} # type: ignore + def _update_put_initial( self, resource_group_name, # type: str @@ -119,32 +236,22 @@ def _update_put_initial( 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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = self._serialize.body(monitoring_setting_resource, 'MonitoringSettingResource') + + request = build_update_put_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + content_type=content_type, + json=_json, + template_url=self._update_put_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -162,8 +269,11 @@ def _update_put_initial( 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 + + @distributed_trace def begin_update_put( self, resource_group_name, # type: str @@ -180,18 +290,24 @@ def begin_update_put( :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 + :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. + :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: + :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 """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.MonitoringSettingResource"] lro_delay = kwargs.pop( 'polling_interval', @@ -203,27 +319,21 @@ def begin_update_put( resource_group_name=resource_group_name, service_name=service_name, monitoring_setting_resource=monitoring_setting_resource, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_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 = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -235,6 +345,7 @@ def get_long_running_output(pipeline_response): ) 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( @@ -250,32 +361,22 @@ def _update_patch_initial( 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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = self._serialize.body(monitoring_setting_resource, 'MonitoringSettingResource') + + request = build_update_patch_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + content_type=content_type, + json=_json, + template_url=self._update_patch_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -293,8 +394,11 @@ def _update_patch_initial( 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 + + @distributed_trace def begin_update_patch( self, resource_group_name, # type: str @@ -311,18 +415,24 @@ def begin_update_patch( :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 + :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. + :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: + :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 """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.MonitoringSettingResource"] lro_delay = kwargs.pop( 'polling_interval', @@ -334,27 +444,21 @@ def begin_update_patch( resource_group_name=resource_group_name, service_name=service_name, monitoring_setting_resource=monitoring_setting_resource, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_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 = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -366,4 +470,5 @@ def get_long_running_output(pipeline_response): ) 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/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2020_11_01_preview/operations/_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2020_11_01_preview/operations/_operations.py index e93fd2c141070..ddbf9da1d8a4c 100644 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2020_11_01_preview/operations/_operations.py +++ b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2020_11_01_preview/operations/_operations.py @@ -5,24 +5,58 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools from typing import TYPE_CHECKING import warnings 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.pipeline.transport import HttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat +from msrest import Serializer from .. import models as _models +from .._vendor import _convert_request 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]] +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False +# fmt: off + +def build_list_request( + **kwargs # type: Any +): + # type: (...) -> HttpRequest + api_version = "2020-11-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/providers/Microsoft.AppPlatform/operations') + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + +# fmt: on class Operations(object): """Operations operations. @@ -45,6 +79,7 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def list( self, **kwargs # type: Any @@ -54,7 +89,8 @@ def list( :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] + :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"] @@ -62,30 +98,27 @@ def list( 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 = build_list_request( + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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) + + request = build_list_request( + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('AvailableOperations', pipeline_response) + deserialized = self._deserialize("AvailableOperations", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -103,6 +136,7 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2020_11_01_preview/operations/_runtime_versions_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2020_11_01_preview/operations/_runtime_versions_operations.py index 5c7e5ce3dc271..b65c065420087 100644 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2020_11_01_preview/operations/_runtime_versions_operations.py +++ b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2020_11_01_preview/operations/_runtime_versions_operations.py @@ -5,23 +5,57 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools from typing import TYPE_CHECKING 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 HttpRequest, HttpResponse +from azure.core.pipeline.transport import HttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat +from msrest import Serializer from .. import models as _models +from .._vendor import _convert_request 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]] +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False +# fmt: off + +def build_list_runtime_versions_request( + **kwargs # type: Any +): + # type: (...) -> HttpRequest + api_version = "2020-11-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/providers/Microsoft.AppPlatform/runtimeVersions') + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + +# fmt: on class RuntimeVersionsOperations(object): """RuntimeVersionsOperations operations. @@ -44,6 +78,7 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def list_runtime_versions( self, **kwargs # type: Any @@ -61,21 +96,14 @@ def list_runtime_versions( 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 = build_list_runtime_versions_request( + template_url=self.list_runtime_versions.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -89,4 +117,6 @@ def list_runtime_versions( return cls(pipeline_response, deserialized, {}) return deserialized + list_runtime_versions.metadata = {'url': '/providers/Microsoft.AppPlatform/runtimeVersions'} # type: ignore + diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2020_11_01_preview/operations/_services_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2020_11_01_preview/operations/_services_operations.py index 2aa4b23d010bf..7b1ffac868cd5 100644 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2020_11_01_preview/operations/_services_operations.py +++ b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2020_11_01_preview/operations/_services_operations.py @@ -5,26 +5,438 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools from typing import TYPE_CHECKING import warnings 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.pipeline.transport import HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling +from msrest import Serializer from .. import models as _models +from .._vendor import _convert_request, _format_url_section 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]] +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False +# fmt: off + +def build_get_request( + subscription_id, # type: str + resource_group_name, # type: str + service_name, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + api_version = "2020-11-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_create_or_update_request_initial( + subscription_id, # type: str + resource_group_name, # type: str + service_name, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2020-11-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_delete_request_initial( + subscription_id, # type: str + resource_group_name, # type: str + service_name, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + api_version = "2020-11-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="DELETE", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_update_request_initial( + subscription_id, # type: str + resource_group_name, # type: str + service_name, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2020-11-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PATCH", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_list_test_keys_request( + subscription_id, # type: str + resource_group_name, # type: str + service_name, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + api_version = "2020-11-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/listTestKeys') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_regenerate_test_key_request( + subscription_id, # type: str + resource_group_name, # type: str + service_name, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2020-11-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/regenerateTestKey') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_disable_test_endpoint_request( + subscription_id, # type: str + resource_group_name, # type: str + service_name, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + api_version = "2020-11-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/disableTestEndpoint') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_enable_test_endpoint_request( + subscription_id, # type: str + resource_group_name, # type: str + service_name, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + api_version = "2020-11-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/enableTestEndpoint') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_check_name_availability_request( + subscription_id, # type: str + location, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2020-11-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.AppPlatform/locations/{location}/checkNameAvailability') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "location": _SERIALIZER.url("location", location, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_list_by_subscription_request( + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + api_version = "2020-11-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.AppPlatform/Spring') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_list_request( + subscription_id, # type: str + resource_group_name, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + api_version = "2020-11-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + +# fmt: on class ServicesOperations(object): """ServicesOperations operations. @@ -47,6 +459,7 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def get( self, resource_group_name, # type: str @@ -71,27 +484,17 @@ def get( 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 = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -105,8 +508,10 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}'} # type: ignore + def _create_or_update_initial( self, resource_group_name, # type: str @@ -120,32 +525,22 @@ def _create_or_update_initial( 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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = self._serialize.body(resource, 'ServiceResource') + + request = build_create_or_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -166,8 +561,11 @@ def _create_or_update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}'} # type: ignore + + @distributed_trace def begin_create_or_update( self, resource_group_name, # type: str @@ -187,15 +585,20 @@ def begin_create_or_update( :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. + :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: + :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 """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.ServiceResource"] lro_delay = kwargs.pop( 'polling_interval', @@ -207,27 +610,21 @@ def begin_create_or_update( resource_group_name=resource_group_name, service_name=service_name, resource=resource, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_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 = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -239,6 +636,7 @@ def get_long_running_output(pipeline_response): ) 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( @@ -253,27 +651,17 @@ def _delete_initial( 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 = build_delete_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -286,6 +674,8 @@ def _delete_initial( _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}'} # type: ignore + + @distributed_trace def begin_delete( self, resource_group_name, # type: str @@ -302,15 +692,17 @@ def begin_delete( :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 ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :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. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -324,21 +716,14 @@ def begin_delete( 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 = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -350,6 +735,7 @@ def get_long_running_output(pipeline_response): ) 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( @@ -365,32 +751,22 @@ def _update_initial( 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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = self._serialize.body(resource, 'ServiceResource') + + request = build_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + content_type=content_type, + json=_json, + template_url=self._update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -408,8 +784,11 @@ def _update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}'} # type: ignore + + @distributed_trace def begin_update( self, resource_group_name, # type: str @@ -429,15 +808,20 @@ def begin_update( :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. + :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: + :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 """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.ServiceResource"] lro_delay = kwargs.pop( 'polling_interval', @@ -449,27 +833,21 @@ def begin_update( resource_group_name=resource_group_name, service_name=service_name, resource=resource, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_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 = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -481,8 +859,10 @@ def get_long_running_output(pipeline_response): ) 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 + @distributed_trace def list_test_keys( self, resource_group_name, # type: str @@ -507,27 +887,17 @@ def list_test_keys( 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 = build_list_test_keys_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + template_url=self.list_test_keys.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -541,8 +911,11 @@ def list_test_keys( return cls(pipeline_response, deserialized, {}) return deserialized + list_test_keys.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/listTestKeys'} # type: ignore + + @distributed_trace def regenerate_test_key( self, resource_group_name, # type: str @@ -559,7 +932,8 @@ def regenerate_test_key( :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 + :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 @@ -570,32 +944,22 @@ def regenerate_test_key( 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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = self._serialize.body(regenerate_test_key_request, 'RegenerateTestKeyRequestPayload') + + request = build_regenerate_test_key_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + content_type=content_type, + json=_json, + template_url=self.regenerate_test_key.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -609,8 +973,11 @@ def regenerate_test_key( return cls(pipeline_response, deserialized, {}) return deserialized + regenerate_test_key.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/regenerateTestKey'} # type: ignore + + @distributed_trace def disable_test_endpoint( self, resource_group_name, # type: str @@ -635,27 +1002,17 @@ def disable_test_endpoint( 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 = build_disable_test_endpoint_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + template_url=self.disable_test_endpoint.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -668,6 +1025,8 @@ def disable_test_endpoint( disable_test_endpoint.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/disableTestEndpoint'} # type: ignore + + @distributed_trace def enable_test_endpoint( self, resource_group_name, # type: str @@ -692,27 +1051,17 @@ def enable_test_endpoint( 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 = build_enable_test_endpoint_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + template_url=self.enable_test_endpoint.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -726,8 +1075,11 @@ def enable_test_endpoint( return cls(pipeline_response, deserialized, {}) return deserialized + enable_test_endpoint.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/enableTestEndpoint'} # type: ignore + + @distributed_trace def check_name_availability( self, location, # type: str @@ -740,7 +1092,8 @@ def check_name_availability( :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 + :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 @@ -751,31 +1104,21 @@ def check_name_availability( 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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = self._serialize.body(availability_parameters, 'NameAvailabilityParameters') + + request = build_check_name_availability_request( + subscription_id=self._config.subscription_id, + location=location, + content_type=content_type, + json=_json, + template_url=self.check_name_availability.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -789,8 +1132,11 @@ def check_name_availability( return cls(pipeline_response, deserialized, {}) return deserialized + check_name_availability.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.AppPlatform/locations/{location}/checkNameAvailability'} # type: ignore + + @distributed_trace def list_by_subscription( self, **kwargs # type: Any @@ -800,7 +1146,8 @@ def list_by_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.paging.ItemPaged[~azure.mgmt.appplatform.v2020_11_01_preview.models.ServiceResourceList] + :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"] @@ -808,34 +1155,29 @@ def list_by_subscription( 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) + + request = build_list_by_subscription_request( + subscription_id=self._config.subscription_id, + template_url=self.list_by_subscription.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_subscription_request( + subscription_id=self._config.subscription_id, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('ServiceResourceList', pipeline_response) + deserialized = self._deserialize("ServiceResourceList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -853,11 +1195,13 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) list_by_subscription.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.AppPlatform/Spring'} # type: ignore + @distributed_trace def list( self, resource_group_name, # type: str @@ -871,7 +1215,8 @@ def list( :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.paging.ItemPaged[~azure.mgmt.appplatform.v2020_11_01_preview.models.ServiceResourceList] + :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"] @@ -879,35 +1224,31 @@ def list( 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) + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('ServiceResourceList', pipeline_response) + deserialized = self._deserialize("ServiceResourceList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -925,6 +1266,7 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2020_11_01_preview/operations/_skus_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2020_11_01_preview/operations/_skus_operations.py index 746347c182fa4..a0d01b32541b6 100644 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2020_11_01_preview/operations/_skus_operations.py +++ b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2020_11_01_preview/operations/_skus_operations.py @@ -5,24 +5,64 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools from typing import TYPE_CHECKING import warnings 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.pipeline.transport import HttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat +from msrest import Serializer from .. import models as _models +from .._vendor import _convert_request, _format_url_section 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]] +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False +# fmt: off + +def build_list_request( + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + api_version = "2020-11-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.AppPlatform/skus') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + +# fmt: on class SkusOperations(object): """SkusOperations operations. @@ -45,6 +85,7 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def list( self, **kwargs # type: Any @@ -53,8 +94,10 @@ def list( """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.paging.ItemPaged[~azure.mgmt.appplatform.v2020_11_01_preview.models.ResourceSkuCollection] + :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"] @@ -62,34 +105,29 @@ def list( 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) + + request = build_list_request( + subscription_id=self._config.subscription_id, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('ResourceSkuCollection', pipeline_response) + deserialized = self._deserialize("ResourceSkuCollection", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -107,6 +145,7 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2021_06_01_preview/__init__.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2021_06_01_preview/__init__.py index d2ddf950056ad..41ec6d71ff7fa 100644 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2021_06_01_preview/__init__.py +++ b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2021_06_01_preview/__init__.py @@ -12,8 +12,7 @@ __version__ = VERSION __all__ = ['AppPlatformManagementClient'] -try: - from ._patch import patch_sdk # type: ignore - patch_sdk() -except ImportError: - pass +# `._patch.py` is used for handwritten extensions to the generated code +# Example: https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md +from ._patch import patch_sdk +patch_sdk() diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2021_06_01_preview/_app_platform_management_client.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2021_06_01_preview/_app_platform_management_client.py index 7deee559a5382..54c07553a0c76 100644 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2021_06_01_preview/_app_platform_management_client.py +++ b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2021_06_01_preview/_app_platform_management_client.py @@ -6,32 +6,22 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from copy import deepcopy from typing import TYPE_CHECKING from azure.mgmt.core import ARMPipelineClient from msrest import Deserializer, Serializer +from . import models +from ._configuration import AppPlatformManagementClientConfiguration +from .operations import AppsOperations, BindingsOperations, CertificatesOperations, ConfigServersOperations, CustomDomainsOperations, DeploymentsOperations, MonitoringSettingsOperations, Operations, RuntimeVersionsOperations, ServicesOperations, SkusOperations + 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 -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 - + from azure.core.rest import HttpRequest, HttpResponse class AppPlatformManagementClient(object): """REST API for Azure Spring Cloud. @@ -39,91 +29,96 @@ class AppPlatformManagementClient(object): :ivar services: ServicesOperations operations :vartype services: azure.mgmt.appplatform.v2021_06_01_preview.operations.ServicesOperations :ivar config_servers: ConfigServersOperations operations - :vartype config_servers: azure.mgmt.appplatform.v2021_06_01_preview.operations.ConfigServersOperations + :vartype config_servers: + azure.mgmt.appplatform.v2021_06_01_preview.operations.ConfigServersOperations :ivar monitoring_settings: MonitoringSettingsOperations operations - :vartype monitoring_settings: azure.mgmt.appplatform.v2021_06_01_preview.operations.MonitoringSettingsOperations + :vartype monitoring_settings: + azure.mgmt.appplatform.v2021_06_01_preview.operations.MonitoringSettingsOperations :ivar apps: AppsOperations operations :vartype apps: azure.mgmt.appplatform.v2021_06_01_preview.operations.AppsOperations :ivar bindings: BindingsOperations operations :vartype bindings: azure.mgmt.appplatform.v2021_06_01_preview.operations.BindingsOperations :ivar certificates: CertificatesOperations operations - :vartype certificates: azure.mgmt.appplatform.v2021_06_01_preview.operations.CertificatesOperations + :vartype certificates: + azure.mgmt.appplatform.v2021_06_01_preview.operations.CertificatesOperations :ivar custom_domains: CustomDomainsOperations operations - :vartype custom_domains: azure.mgmt.appplatform.v2021_06_01_preview.operations.CustomDomainsOperations + :vartype custom_domains: + azure.mgmt.appplatform.v2021_06_01_preview.operations.CustomDomainsOperations :ivar deployments: DeploymentsOperations operations - :vartype deployments: azure.mgmt.appplatform.v2021_06_01_preview.operations.DeploymentsOperations + :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: RuntimeVersionsOperations operations - :vartype runtime_versions: azure.mgmt.appplatform.v2021_06_01_preview.operations.RuntimeVersionsOperations + :vartype runtime_versions: + azure.mgmt.appplatform.v2021_06_01_preview.operations.RuntimeVersionsOperations :ivar skus: SkusOperations operations :vartype skus: azure.mgmt.appplatform.v2021_06_01_preview.operations.SkusOperations :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. + :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. + :param base_url: Service URL. Default value is 'https://management.azure.com'. + :type base_url: str + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. """ def __init__( self, credential, # type: "TokenCredential" subscription_id, # type: str - base_url=None, # type: Optional[str] + base_url="https://management.azure.com", # type: str **kwargs # type: Any ): # type: (...) -> None - if not base_url: - base_url = 'https://management.azure.com' - self._config = AppPlatformManagementClientConfiguration(credential, subscription_id, **kwargs) + self._config = AppPlatformManagementClientConfiguration(credential=credential, subscription_id=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._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) - - def _send_request(self, http_request, **kwargs): - # type: (HttpRequest, Any) -> HttpResponse + self._serialize.client_side_validation = False + 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) + + + def _send_request( + self, + request, # type: HttpRequest + **kwargs # type: Any + ): + # type: (...) -> 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. + >>> from azure.core.rest import HttpRequest + >>> request = HttpRequest("GET", "https://www.example.org/") + + >>> response = client._send_request(request) + + + For more information on this code flow, see https://aka.ms/azsdk/python/protocol/quickstart + + :param request: The network request you want to make. Required. + :type request: ~azure.core.rest.HttpRequest + :keyword bool stream: Whether the response payload will be streamed. Defaults to False. :return: The response of your network call. Does not do error handling on your response. - :rtype: ~azure.core.pipeline.transport.HttpResponse + :rtype: ~azure.core.rest.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 + + request_copy = deepcopy(request) + request_copy.url = self._client.format_url(request_copy.url) + return self._client.send_request(request_copy, **kwargs) def close(self): # type: () -> None diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2021_06_01_preview/_configuration.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2021_06_01_preview/_configuration.py index a358948766fb6..9b285920ecaf8 100644 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2021_06_01_preview/_configuration.py +++ b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2021_06_01_preview/_configuration.py @@ -10,7 +10,7 @@ from azure.core.configuration import Configuration from azure.core.pipeline import policies -from azure.mgmt.core.policies import ARMHttpLoggingPolicy +from azure.mgmt.core.policies import ARMChallengeAuthenticationPolicy, ARMHttpLoggingPolicy from ._version import VERSION @@ -40,11 +40,11 @@ def __init__( **kwargs # type: Any ): # type: (...) -> None + super(AppPlatformManagementClientConfiguration, self).__init__(**kwargs) 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 @@ -68,4 +68,4 @@ def _configure( 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) + self.authentication_policy = ARMChallengeAuthenticationPolicy(self.credential, *self.credential_scopes, **kwargs) diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2021_06_01_preview/_metadata.json b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2021_06_01_preview/_metadata.json index c8bb068cd9a79..a3132cd2e192b 100644 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2021_06_01_preview/_metadata.json +++ b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2021_06_01_preview/_metadata.json @@ -5,13 +5,13 @@ "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, + "host_value": "\"https://management.azure.com\"", + "parameterized_host_template": 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\"]}}}" + "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\"]}}}", + "async_imports": "{\"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"], \"azure.core.credentials\": [\"TokenCredential\"]}}, \"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\"]}}}" }, "global_parameters": { "sync": { @@ -54,7 +54,7 @@ "required": false }, "base_url": { - "signature": "base_url=None, # type: Optional[str]", + "signature": "base_url=\"https://management.azure.com\", # type: str", "description": "Service URL", "docstring_type": "str", "required": false @@ -74,7 +74,7 @@ "required": false }, "base_url": { - "signature": "base_url: Optional[str] = None,", + "signature": "base_url: str = \"https://management.azure.com\",", "description": "Service URL", "docstring_type": "str", "required": false @@ -91,11 +91,10 @@ "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\"]}}}" + "credential_call_sync": "ARMChallengeAuthenticationPolicy(self.credential, *self.credential_scopes, **kwargs)", + "credential_call_async": "AsyncARMChallengeAuthenticationPolicy(self.credential, *self.credential_scopes, **kwargs)", + "sync_imports": "{\"regular\": {\"azurecore\": {\"azure.core.configuration\": [\"Configuration\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMChallengeAuthenticationPolicy\", \"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\", \"AsyncARMChallengeAuthenticationPolicy\"]}, \"local\": {\".._version\": [\"VERSION\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\"]}}, \"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}}" }, "operation_groups": { "services": "ServicesOperations", diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2021_06_01_preview/_patch.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2021_06_01_preview/_patch.py new file mode 100644 index 0000000000000..74e48ecd07cf3 --- /dev/null +++ b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2021_06_01_preview/_patch.py @@ -0,0 +1,31 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# +# Copyright (c) Microsoft Corporation. All rights reserved. +# +# The MIT License (MIT) +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the ""Software""), to +# deal in the Software without restriction, including without limitation the +# rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +# sell copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in +# all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED *AS IS*, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +# IN THE SOFTWARE. +# +# -------------------------------------------------------------------------- + +# This file is used for handwritten extensions to the generated code. Example: +# https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md +def patch_sdk(): + pass \ No newline at end of file diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2021_06_01_preview/_vendor.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2021_06_01_preview/_vendor.py new file mode 100644 index 0000000000000..138f663c53a4e --- /dev/null +++ b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2021_06_01_preview/_vendor.py @@ -0,0 +1,27 @@ +# -------------------------------------------------------------------------- +# 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 azure.core.pipeline.transport import HttpRequest + +def _convert_request(request, files=None): + data = request.content if not files else None + request = HttpRequest(method=request.method, url=request.url, headers=request.headers, data=data) + if files: + request.set_formdata_body(files) + return request + +def _format_url_section(template, **kwargs): + components = template.split("/") + while components: + try: + return template.format(**kwargs) + except KeyError as key: + formatted_components = template.split("/") + components = [ + c for c in formatted_components if "{}".format(key.args[0]) not in c + ] + template = "/".join(components) diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2021_06_01_preview/_version.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2021_06_01_preview/_version.py index 92453d8691d96..e5754a47ce68f 100644 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2021_06_01_preview/_version.py +++ b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2021_06_01_preview/_version.py @@ -6,4 +6,4 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "6.1.0" +VERSION = "1.0.0b1" diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2021_06_01_preview/aio/__init__.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2021_06_01_preview/aio/__init__.py index 39f1054887358..44ce4a5043f80 100644 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2021_06_01_preview/aio/__init__.py +++ b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2021_06_01_preview/aio/__init__.py @@ -8,3 +8,8 @@ from ._app_platform_management_client import AppPlatformManagementClient __all__ = ['AppPlatformManagementClient'] + +# `._patch.py` is used for handwritten extensions to the generated code +# Example: https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md +from ._patch import patch_sdk +patch_sdk() diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2021_06_01_preview/aio/_app_platform_management_client.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2021_06_01_preview/aio/_app_platform_management_client.py index dfc7ace8ede54..1a52c8cbaff5a 100644 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2021_06_01_preview/aio/_app_platform_management_client.py +++ b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2021_06_01_preview/aio/_app_platform_management_client.py @@ -6,120 +6,115 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, Optional, TYPE_CHECKING +from copy import deepcopy +from typing import Any, Awaitable, Optional, TYPE_CHECKING -from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.mgmt.core import AsyncARMPipelineClient from msrest import Deserializer, Serializer +from .. import models +from ._configuration import AppPlatformManagementClientConfiguration +from .operations import AppsOperations, BindingsOperations, CertificatesOperations, ConfigServersOperations, CustomDomainsOperations, DeploymentsOperations, MonitoringSettingsOperations, Operations, RuntimeVersionsOperations, ServicesOperations, SkusOperations + 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): +class AppPlatformManagementClient: """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 + :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 + :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 + :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 + :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 + :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 + :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. + :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. + :param base_url: Service URL. Default value is 'https://management.azure.com'. + :type base_url: str + :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, + base_url: str = "https://management.azure.com", **kwargs: Any ) -> None: - if not base_url: - base_url = 'https://management.azure.com' - self._config = AppPlatformManagementClientConfiguration(credential, subscription_id, **kwargs) + self._config = AppPlatformManagementClientConfiguration(credential=credential, subscription_id=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._serialize.client_side_validation = False + 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) + - 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: + def _send_request( + self, + request: HttpRequest, + **kwargs: Any + ) -> Awaitable[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. + >>> from azure.core.rest import HttpRequest + >>> request = HttpRequest("GET", "https://www.example.org/") + + >>> response = await client._send_request(request) + + + For more information on this code flow, see https://aka.ms/azsdk/python/protocol/quickstart + + :param request: The network request you want to make. Required. + :type request: ~azure.core.rest.HttpRequest + :keyword bool stream: Whether the response payload will be streamed. Defaults to False. :return: The response of your network call. Does not do error handling on your response. - :rtype: ~azure.core.pipeline.transport.AsyncHttpResponse + :rtype: ~azure.core.rest.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 + + request_copy = deepcopy(request) + request_copy.url = self._client.format_url(request_copy.url) + return self._client.send_request(request_copy, **kwargs) async def close(self) -> None: await self._client.close() diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2021_06_01_preview/aio/_configuration.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2021_06_01_preview/aio/_configuration.py index 80c22c56c44fa..c08c3df917cf3 100644 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2021_06_01_preview/aio/_configuration.py +++ b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2021_06_01_preview/aio/_configuration.py @@ -10,7 +10,7 @@ from azure.core.configuration import Configuration from azure.core.pipeline import policies -from azure.mgmt.core.policies import ARMHttpLoggingPolicy +from azure.mgmt.core.policies import ARMHttpLoggingPolicy, AsyncARMChallengeAuthenticationPolicy from .._version import VERSION @@ -37,11 +37,11 @@ def __init__( subscription_id: str, **kwargs: Any ) -> None: + super(AppPlatformManagementClientConfiguration, self).__init__(**kwargs) 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 @@ -64,4 +64,4 @@ def _configure( 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) + self.authentication_policy = AsyncARMChallengeAuthenticationPolicy(self.credential, *self.credential_scopes, **kwargs) diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2021_06_01_preview/aio/_patch.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2021_06_01_preview/aio/_patch.py new file mode 100644 index 0000000000000..74e48ecd07cf3 --- /dev/null +++ b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2021_06_01_preview/aio/_patch.py @@ -0,0 +1,31 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# +# Copyright (c) Microsoft Corporation. All rights reserved. +# +# The MIT License (MIT) +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the ""Software""), to +# deal in the Software without restriction, including without limitation the +# rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +# sell copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in +# all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED *AS IS*, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +# IN THE SOFTWARE. +# +# -------------------------------------------------------------------------- + +# This file is used for handwritten extensions to the generated code. Example: +# https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md +def patch_sdk(): + pass \ No newline at end of file diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2021_06_01_preview/aio/operations/_apps_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2021_06_01_preview/aio/operations/_apps_operations.py index 4de955a71684d..e206946240b6f 100644 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2021_06_01_preview/aio/operations/_apps_operations.py +++ b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2021_06_01_preview/aio/operations/_apps_operations.py @@ -5,19 +5,24 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools 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.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._apps_operations import build_create_or_update_request_initial, build_delete_request_initial, build_get_request, build_get_resource_upload_url_request, build_list_request, build_update_request_initial, build_validate_domain_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -43,6 +48,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace_async async def get( self, resource_group_name: str, @@ -72,30 +78,19 @@ async def get( 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 = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + sync_status=sync_status, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -109,8 +104,10 @@ async def get( 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, @@ -124,33 +121,23 @@ async def _create_or_update_initial( 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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = self._serialize.body(app_resource, 'AppResource') + + request = build_create_or_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -171,8 +158,11 @@ async def _create_or_update_initial( 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 + + @distributed_trace_async async def begin_create_or_update( self, resource_group_name: str, @@ -194,15 +184,20 @@ async def begin_create_or_update( :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. + :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: + :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] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.AppResource"] lro_delay = kwargs.pop( 'polling_interval', @@ -215,28 +210,21 @@ async def begin_create_or_update( service_name=service_name, app_name=app_name, app_resource=app_resource, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_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) + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -248,6 +236,7 @@ def get_long_running_output(pipeline_response): ) 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( @@ -262,28 +251,18 @@ async def _delete_initial( 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 = build_delete_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -296,6 +275,8 @@ async def _delete_initial( _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}'} # type: ignore + + @distributed_trace_async async def begin_delete( self, resource_group_name: str, @@ -314,15 +295,17 @@ async def begin_delete( :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. + :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. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -337,22 +320,14 @@ async def begin_delete( 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) + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -364,6 +339,7 @@ def get_long_running_output(pipeline_response): ) 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( @@ -379,33 +355,23 @@ async def _update_initial( 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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(app_resource, 'AppResource') - # 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') + request = build_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + content_type=content_type, + json=_json, + template_url=self._update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -423,8 +389,11 @@ async def _update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}'} # type: ignore + + @distributed_trace_async async def begin_update( self, resource_group_name: str, @@ -446,15 +415,20 @@ async def begin_update( :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. + :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: + :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] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.AppResource"] lro_delay = kwargs.pop( 'polling_interval', @@ -467,28 +441,21 @@ async def begin_update( service_name=service_name, app_name=app_name, app_resource=app_resource, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_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) + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -500,8 +467,10 @@ def get_long_running_output(pipeline_response): ) 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 + @distributed_trace def list( self, resource_group_name: str, @@ -516,8 +485,10 @@ def list( :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] + :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"] @@ -525,36 +496,33 @@ def list( 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) + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('AppResourceCollection', pipeline_response) + deserialized = self._deserialize("AppResourceCollection", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -572,11 +540,13 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps'} # type: ignore + @distributed_trace_async async def get_resource_upload_url( self, resource_group_name: str, @@ -603,28 +573,18 @@ async def get_resource_upload_url( 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 = build_get_resource_upload_url_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + template_url=self.get_resource_upload_url.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -638,8 +598,11 @@ async def get_resource_upload_url( 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 + + @distributed_trace_async async def validate_domain( self, resource_group_name: str, @@ -658,7 +621,8 @@ async def validate_domain( :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 + :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 @@ -669,33 +633,23 @@ async def validate_domain( 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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(validate_payload, 'CustomDomainValidatePayload') - # 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') + request = build_validate_domain_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + content_type=content_type, + json=_json, + template_url=self.validate_domain.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -709,4 +663,6 @@ async def validate_domain( 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/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2021_06_01_preview/aio/operations/_bindings_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2021_06_01_preview/aio/operations/_bindings_operations.py index b4572f289dafe..d883af9dff034 100644 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2021_06_01_preview/aio/operations/_bindings_operations.py +++ b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2021_06_01_preview/aio/operations/_bindings_operations.py @@ -5,19 +5,24 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools 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.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._bindings_operations import build_create_or_update_request_initial, build_delete_request_initial, build_get_request, build_list_request, build_update_request_initial T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -43,6 +48,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace_async async def get( self, resource_group_name: str, @@ -72,29 +78,19 @@ async def get( 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 = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + binding_name=binding_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -108,8 +104,10 @@ async def get( 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, @@ -124,34 +122,24 @@ async def _create_or_update_initial( 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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = self._serialize.body(binding_resource, 'BindingResource') + + request = build_create_or_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + binding_name=binding_name, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -172,8 +160,11 @@ async def _create_or_update_initial( 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 + + @distributed_trace_async async def begin_create_or_update( self, resource_group_name: str, @@ -198,15 +189,20 @@ async def begin_create_or_update( :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. + :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: + :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] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.BindingResource"] lro_delay = kwargs.pop( 'polling_interval', @@ -220,29 +216,21 @@ async def begin_create_or_update( app_name=app_name, binding_name=binding_name, binding_resource=binding_resource, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_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) + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -254,6 +242,7 @@ def get_long_running_output(pipeline_response): ) 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( @@ -269,29 +258,19 @@ async def _delete_initial( 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 = build_delete_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + binding_name=binding_name, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -304,6 +283,8 @@ async def _delete_initial( _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/bindings/{bindingName}'} # type: ignore + + @distributed_trace_async async def begin_delete( self, resource_group_name: str, @@ -325,15 +306,17 @@ async def begin_delete( :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. + :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. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -349,23 +332,14 @@ async def begin_delete( 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) + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -377,6 +351,7 @@ def get_long_running_output(pipeline_response): ) 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( @@ -393,34 +368,24 @@ async def _update_initial( 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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(binding_resource, 'BindingResource') - # 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') + request = build_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + binding_name=binding_name, + content_type=content_type, + json=_json, + template_url=self._update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -438,8 +403,11 @@ async def _update_initial( 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 + + @distributed_trace_async async def begin_update( self, resource_group_name: str, @@ -464,15 +432,20 @@ async def begin_update( :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. + :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: + :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] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.BindingResource"] lro_delay = kwargs.pop( 'polling_interval', @@ -486,29 +459,21 @@ async def begin_update( app_name=app_name, binding_name=binding_name, binding_resource=binding_resource, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_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) + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -520,8 +485,10 @@ def get_long_running_output(pipeline_response): ) 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 + @distributed_trace def list( self, resource_group_name: str, @@ -539,8 +506,10 @@ def list( :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] + :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"] @@ -548,37 +517,35 @@ def list( 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) + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('BindingResourceCollection', pipeline_response) + deserialized = self._deserialize("BindingResourceCollection", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -596,6 +563,7 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2021_06_01_preview/aio/operations/_certificates_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2021_06_01_preview/aio/operations/_certificates_operations.py index 60ac54d760770..95f48721f56c0 100644 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2021_06_01_preview/aio/operations/_certificates_operations.py +++ b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2021_06_01_preview/aio/operations/_certificates_operations.py @@ -5,19 +5,24 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools 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.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._certificates_operations import build_create_or_update_request_initial, build_delete_request_initial, build_get_request, build_list_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -43,6 +48,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace_async async def get( self, resource_group_name: str, @@ -69,28 +75,18 @@ async def get( 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 = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + certificate_name=certificate_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -104,8 +100,10 @@ async def get( 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, @@ -119,33 +117,23 @@ async def _create_or_update_initial( 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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = self._serialize.body(certificate_resource, 'CertificateResource') + + request = build_create_or_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + certificate_name=certificate_name, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -166,8 +154,11 @@ async def _create_or_update_initial( 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 + + @distributed_trace_async async def begin_create_or_update( self, resource_group_name: str, @@ -186,18 +177,24 @@ async def begin_create_or_update( :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 + :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. + :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: + :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] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.CertificateResource"] lro_delay = kwargs.pop( 'polling_interval', @@ -210,28 +207,21 @@ async def begin_create_or_update( service_name=service_name, certificate_name=certificate_name, certificate_resource=certificate_resource, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_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) + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -243,6 +233,7 @@ def get_long_running_output(pipeline_response): ) 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( @@ -257,28 +248,18 @@ async def _delete_initial( 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 = build_delete_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + certificate_name=certificate_name, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -291,6 +272,8 @@ async def _delete_initial( _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/certificates/{certificateName}'} # type: ignore + + @distributed_trace_async async def begin_delete( self, resource_group_name: str, @@ -309,15 +292,17 @@ async def begin_delete( :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. + :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. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -332,22 +317,14 @@ async def begin_delete( 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) + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -359,8 +336,10 @@ def get_long_running_output(pipeline_response): ) 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 + @distributed_trace def list( self, resource_group_name: str, @@ -375,8 +354,10 @@ def list( :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] + :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"] @@ -384,36 +365,33 @@ def list( 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) + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('CertificateResourceCollection', pipeline_response) + deserialized = self._deserialize("CertificateResourceCollection", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -431,6 +409,7 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2021_06_01_preview/aio/operations/_config_servers_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2021_06_01_preview/aio/operations/_config_servers_operations.py index b032bebe43dc6..11bafa078b780 100644 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2021_06_01_preview/aio/operations/_config_servers_operations.py +++ b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2021_06_01_preview/aio/operations/_config_servers_operations.py @@ -5,18 +5,22 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools 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.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._config_servers_operations import build_get_request, build_update_patch_request_initial, build_update_put_request_initial, build_validate_request_initial T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -42,6 +46,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace_async async def get( self, resource_group_name: str, @@ -65,27 +70,17 @@ async def get( 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 = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -99,8 +94,10 @@ async def get( 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, @@ -113,32 +110,22 @@ async def _update_put_initial( 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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = self._serialize.body(config_server_resource, 'ConfigServerResource') + + request = build_update_put_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + content_type=content_type, + json=_json, + template_url=self._update_put_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -156,8 +143,11 @@ async def _update_put_initial( 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 + + @distributed_trace_async async def begin_update_put( self, resource_group_name: str, @@ -173,18 +163,24 @@ async def begin_update_put( :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 + :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. + :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: + :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] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.ConfigServerResource"] lro_delay = kwargs.pop( 'polling_interval', @@ -196,27 +192,21 @@ async def begin_update_put( resource_group_name=resource_group_name, service_name=service_name, config_server_resource=config_server_resource, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_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) + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -228,6 +218,7 @@ def get_long_running_output(pipeline_response): ) 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( @@ -242,32 +233,22 @@ async def _update_patch_initial( 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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(config_server_resource, 'ConfigServerResource') - # 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') + request = build_update_patch_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + content_type=content_type, + json=_json, + template_url=self._update_patch_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -285,8 +266,11 @@ async def _update_patch_initial( 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 + + @distributed_trace_async async def begin_update_patch( self, resource_group_name: str, @@ -302,18 +286,24 @@ async def begin_update_patch( :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 + :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. + :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: + :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] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.ConfigServerResource"] lro_delay = kwargs.pop( 'polling_interval', @@ -325,27 +315,21 @@ async def begin_update_patch( resource_group_name=resource_group_name, service_name=service_name, config_server_resource=config_server_resource, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_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) + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -357,6 +341,7 @@ def get_long_running_output(pipeline_response): ) 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( @@ -371,32 +356,22 @@ async def _validate_initial( 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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = self._serialize.body(config_server_settings, 'ConfigServerSettings') + + request = build_validate_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + content_type=content_type, + json=_json, + template_url=self._validate_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -414,8 +389,11 @@ async def _validate_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _validate_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configServers/validate'} # type: ignore + + @distributed_trace_async async def begin_validate( self, resource_group_name: str, @@ -431,18 +409,24 @@ async def begin_validate( :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 + :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. + :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: + :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] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.ConfigServerSettingsValidateResult"] lro_delay = kwargs.pop( 'polling_interval', @@ -454,27 +438,21 @@ async def begin_validate( resource_group_name=resource_group_name, service_name=service_name, config_server_settings=config_server_settings, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_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) + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -486,4 +464,5 @@ def get_long_running_output(pipeline_response): ) 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/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2021_06_01_preview/aio/operations/_custom_domains_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2021_06_01_preview/aio/operations/_custom_domains_operations.py index 4c1b197d9f5d7..30a3a789403db 100644 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2021_06_01_preview/aio/operations/_custom_domains_operations.py +++ b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2021_06_01_preview/aio/operations/_custom_domains_operations.py @@ -5,19 +5,24 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools 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.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._custom_domains_operations import build_create_or_update_request_initial, build_delete_request_initial, build_get_request, build_list_request, build_update_request_initial T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -43,6 +48,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace_async async def get( self, resource_group_name: str, @@ -72,29 +78,19 @@ async def get( 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 = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + domain_name=domain_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -108,8 +104,10 @@ async def get( 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, @@ -124,34 +122,24 @@ async def _create_or_update_initial( 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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = self._serialize.body(domain_resource, 'CustomDomainResource') + + request = build_create_or_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + domain_name=domain_name, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -172,8 +160,11 @@ async def _create_or_update_initial( 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 + + @distributed_trace_async async def begin_create_or_update( self, resource_group_name: str, @@ -198,15 +189,20 @@ async def begin_create_or_update( :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. + :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: + :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] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.CustomDomainResource"] lro_delay = kwargs.pop( 'polling_interval', @@ -220,29 +216,21 @@ async def begin_create_or_update( app_name=app_name, domain_name=domain_name, domain_resource=domain_resource, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_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) + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -254,6 +242,7 @@ def get_long_running_output(pipeline_response): ) 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( @@ -269,29 +258,19 @@ async def _delete_initial( 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 = build_delete_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + domain_name=domain_name, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -304,6 +283,8 @@ async def _delete_initial( _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/domains/{domainName}'} # type: ignore + + @distributed_trace_async async def begin_delete( self, resource_group_name: str, @@ -325,15 +306,17 @@ async def begin_delete( :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. + :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. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -349,23 +332,14 @@ async def begin_delete( 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) + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -377,6 +351,7 @@ def get_long_running_output(pipeline_response): ) 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( @@ -393,34 +368,24 @@ async def _update_initial( 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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(domain_resource, 'CustomDomainResource') - # 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') + request = build_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + domain_name=domain_name, + content_type=content_type, + json=_json, + template_url=self._update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -438,8 +403,11 @@ async def _update_initial( 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 + + @distributed_trace_async async def begin_update( self, resource_group_name: str, @@ -464,15 +432,20 @@ async def begin_update( :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. + :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: + :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] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.CustomDomainResource"] lro_delay = kwargs.pop( 'polling_interval', @@ -486,29 +459,21 @@ async def begin_update( app_name=app_name, domain_name=domain_name, domain_resource=domain_resource, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_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) + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -520,8 +485,10 @@ def get_long_running_output(pipeline_response): ) 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 + @distributed_trace def list( self, resource_group_name: str, @@ -539,8 +506,10 @@ def list( :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] + :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"] @@ -548,37 +517,35 @@ def list( 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) + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('CustomDomainResourceCollection', pipeline_response) + deserialized = self._deserialize("CustomDomainResourceCollection", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -596,6 +563,7 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2021_06_01_preview/aio/operations/_deployments_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2021_06_01_preview/aio/operations/_deployments_operations.py index ef6fc17c694dd..f402fcb7071c2 100644 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2021_06_01_preview/aio/operations/_deployments_operations.py +++ b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2021_06_01_preview/aio/operations/_deployments_operations.py @@ -5,19 +5,24 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools 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.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._deployments_operations import build_create_or_update_request_initial, build_delete_request_initial, build_get_log_file_url_request, build_get_request, build_list_for_cluster_request, build_list_request, build_restart_request_initial, build_start_request_initial, build_stop_request_initial, build_update_request_initial T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -43,6 +48,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace_async async def get( self, resource_group_name: str, @@ -72,29 +78,19 @@ async def get( 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 = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + deployment_name=deployment_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -108,8 +104,10 @@ async def get( 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, @@ -124,34 +122,24 @@ async def _create_or_update_initial( 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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = self._serialize.body(deployment_resource, 'DeploymentResource') + + request = build_create_or_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + deployment_name=deployment_name, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -172,8 +160,11 @@ async def _create_or_update_initial( 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 + + @distributed_trace_async async def begin_create_or_update( self, resource_group_name: str, @@ -195,18 +186,24 @@ async def begin_create_or_update( :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 + :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. + :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: + :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] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.DeploymentResource"] lro_delay = kwargs.pop( 'polling_interval', @@ -220,29 +217,21 @@ async def begin_create_or_update( app_name=app_name, deployment_name=deployment_name, deployment_resource=deployment_resource, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_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) + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -254,6 +243,7 @@ def get_long_running_output(pipeline_response): ) 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( @@ -269,29 +259,19 @@ async def _delete_initial( 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 = build_delete_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + deployment_name=deployment_name, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -304,6 +284,8 @@ async def _delete_initial( _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}'} # type: ignore + + @distributed_trace_async async def begin_delete( self, resource_group_name: str, @@ -325,15 +307,17 @@ async def begin_delete( :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. + :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. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -349,23 +333,14 @@ async def begin_delete( 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) + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -377,6 +352,7 @@ def get_long_running_output(pipeline_response): ) 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( @@ -393,34 +369,24 @@ async def _update_initial( 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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = self._serialize.body(deployment_resource, 'DeploymentResource') + + request = build_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + deployment_name=deployment_name, + content_type=content_type, + json=_json, + template_url=self._update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -438,8 +404,11 @@ async def _update_initial( 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 + + @distributed_trace_async async def begin_update( self, resource_group_name: str, @@ -461,18 +430,24 @@ async def begin_update( :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 + :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. + :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: + :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] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.DeploymentResource"] lro_delay = kwargs.pop( 'polling_interval', @@ -486,29 +461,21 @@ async def begin_update( app_name=app_name, deployment_name=deployment_name, deployment_resource=deployment_resource, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_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) + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -520,8 +487,10 @@ def get_long_running_output(pipeline_response): ) 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 + @distributed_trace def list( self, resource_group_name: str, @@ -542,8 +511,10 @@ def list( :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] + :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"] @@ -551,39 +522,37 @@ def list( 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) + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + version=version, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + version=version, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('DeploymentResourceCollection', pipeline_response) + deserialized = self._deserialize("DeploymentResourceCollection", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -601,11 +570,13 @@ async def get_next(next_link=None): 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 + @distributed_trace def list_for_cluster( self, resource_group_name: str, @@ -623,8 +594,10 @@ def list_for_cluster( :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] + :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"] @@ -632,38 +605,35 @@ def list_for_cluster( 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) + + request = build_list_for_cluster_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + version=version, + template_url=self.list_for_cluster.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_for_cluster_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + version=version, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('DeploymentResourceCollection', pipeline_response) + deserialized = self._deserialize("DeploymentResourceCollection", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -681,6 +651,7 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) @@ -699,29 +670,19 @@ async def _start_initial( 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 = build_start_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + deployment_name=deployment_name, + template_url=self._start_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -734,6 +695,8 @@ async def _start_initial( _start_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/start'} # type: ignore + + @distributed_trace_async async def begin_start( self, resource_group_name: str, @@ -755,15 +718,17 @@ async def begin_start( :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. + :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. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -779,23 +744,14 @@ async def begin_start( 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) + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -807,6 +763,7 @@ def get_long_running_output(pipeline_response): ) 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( @@ -822,29 +779,19 @@ async def _stop_initial( 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 = build_stop_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + deployment_name=deployment_name, + template_url=self._stop_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -857,6 +804,8 @@ async def _stop_initial( _stop_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/stop'} # type: ignore + + @distributed_trace_async async def begin_stop( self, resource_group_name: str, @@ -878,15 +827,17 @@ async def begin_stop( :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. + :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. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -902,23 +853,14 @@ async def begin_stop( 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) + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -930,6 +872,7 @@ def get_long_running_output(pipeline_response): ) 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( @@ -945,29 +888,19 @@ async def _restart_initial( 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 = build_restart_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + deployment_name=deployment_name, + template_url=self._restart_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -980,6 +913,8 @@ async def _restart_initial( _restart_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/restart'} # type: ignore + + @distributed_trace_async async def begin_restart( self, resource_group_name: str, @@ -1001,15 +936,17 @@ async def begin_restart( :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. + :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. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -1025,23 +962,14 @@ async def begin_restart( 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) + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -1053,8 +981,10 @@ def get_long_running_output(pipeline_response): ) 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 + @distributed_trace_async async def get_log_file_url( self, resource_group_name: str, @@ -1084,29 +1014,19 @@ async def get_log_file_url( 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 = build_get_log_file_url_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + deployment_name=deployment_name, + template_url=self.get_log_file_url.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -1122,4 +1042,6 @@ async def get_log_file_url( 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/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2021_06_01_preview/aio/operations/_monitoring_settings_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2021_06_01_preview/aio/operations/_monitoring_settings_operations.py index 49ecf2833cd8e..1fd084c425451 100644 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2021_06_01_preview/aio/operations/_monitoring_settings_operations.py +++ b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2021_06_01_preview/aio/operations/_monitoring_settings_operations.py @@ -5,18 +5,22 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools 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.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._monitoring_settings_operations import build_get_request, build_update_patch_request_initial, build_update_put_request_initial T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -42,6 +46,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace_async async def get( self, resource_group_name: str, @@ -65,27 +70,17 @@ async def get( 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 = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -99,8 +94,10 @@ async def get( 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, @@ -113,32 +110,22 @@ async def _update_put_initial( 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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = self._serialize.body(monitoring_setting_resource, 'MonitoringSettingResource') + + request = build_update_put_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + content_type=content_type, + json=_json, + template_url=self._update_put_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -156,8 +143,11 @@ async def _update_put_initial( 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 + + @distributed_trace_async async def begin_update_put( self, resource_group_name: str, @@ -173,18 +163,24 @@ async def begin_update_put( :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 + :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. + :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: + :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] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.MonitoringSettingResource"] lro_delay = kwargs.pop( 'polling_interval', @@ -196,27 +192,21 @@ async def begin_update_put( resource_group_name=resource_group_name, service_name=service_name, monitoring_setting_resource=monitoring_setting_resource, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_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) + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -228,6 +218,7 @@ def get_long_running_output(pipeline_response): ) 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( @@ -242,32 +233,22 @@ async def _update_patch_initial( 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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = self._serialize.body(monitoring_setting_resource, 'MonitoringSettingResource') + + request = build_update_patch_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + content_type=content_type, + json=_json, + template_url=self._update_patch_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -285,8 +266,11 @@ async def _update_patch_initial( 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 + + @distributed_trace_async async def begin_update_patch( self, resource_group_name: str, @@ -302,18 +286,24 @@ async def begin_update_patch( :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 + :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. + :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: + :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] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.MonitoringSettingResource"] lro_delay = kwargs.pop( 'polling_interval', @@ -325,27 +315,21 @@ async def begin_update_patch( resource_group_name=resource_group_name, service_name=service_name, monitoring_setting_resource=monitoring_setting_resource, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_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) + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -357,4 +341,5 @@ def get_long_running_output(pipeline_response): ) 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/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2021_06_01_preview/aio/operations/_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2021_06_01_preview/aio/operations/_operations.py index 8ccd1eee431ec..19b27ba4a9cfb 100644 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2021_06_01_preview/aio/operations/_operations.py +++ b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2021_06_01_preview/aio/operations/_operations.py @@ -5,17 +5,22 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools 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.core.pipeline.transport import AsyncHttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._operations import build_list_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -41,6 +46,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace def list( self, **kwargs: Any @@ -49,7 +55,8 @@ def list( :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] + :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"] @@ -57,30 +64,27 @@ def list( 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 = build_list_request( + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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) + + request = build_list_request( + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('AvailableOperations', pipeline_response) + deserialized = self._deserialize("AvailableOperations", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -98,6 +102,7 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2021_06_01_preview/aio/operations/_runtime_versions_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2021_06_01_preview/aio/operations/_runtime_versions_operations.py index 1b2936a30aacb..63f96bc12d3f0 100644 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2021_06_01_preview/aio/operations/_runtime_versions_operations.py +++ b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2021_06_01_preview/aio/operations/_runtime_versions_operations.py @@ -5,16 +5,20 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools 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.core.pipeline.transport import AsyncHttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._runtime_versions_operations import build_list_runtime_versions_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -40,6 +44,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace_async async def list_runtime_versions( self, **kwargs: Any @@ -56,21 +61,14 @@ async def list_runtime_versions( 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 = build_list_runtime_versions_request( + template_url=self.list_runtime_versions.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -84,4 +82,6 @@ async def list_runtime_versions( return cls(pipeline_response, deserialized, {}) return deserialized + list_runtime_versions.metadata = {'url': '/providers/Microsoft.AppPlatform/runtimeVersions'} # type: ignore + diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2021_06_01_preview/aio/operations/_services_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2021_06_01_preview/aio/operations/_services_operations.py index a7d0539bc531e..7a477834ae21a 100644 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2021_06_01_preview/aio/operations/_services_operations.py +++ b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2021_06_01_preview/aio/operations/_services_operations.py @@ -5,19 +5,24 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools 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.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._services_operations import build_check_name_availability_request, build_create_or_update_request_initial, build_delete_request_initial, build_disable_test_endpoint_request, build_enable_test_endpoint_request, build_get_request, build_list_by_subscription_request, build_list_request, build_list_test_keys_request, build_regenerate_test_key_request, build_update_request_initial T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -43,6 +48,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace_async async def get( self, resource_group_name: str, @@ -66,27 +72,17 @@ async def get( 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 = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -100,8 +96,10 @@ async def get( 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, @@ -114,32 +112,22 @@ async def _create_or_update_initial( 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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = self._serialize.body(resource, 'ServiceResource') + + request = build_create_or_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -160,8 +148,11 @@ async def _create_or_update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}'} # type: ignore + + @distributed_trace_async async def begin_create_or_update( self, resource_group_name: str, @@ -180,15 +171,20 @@ async def begin_create_or_update( :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. + :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: + :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] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.ServiceResource"] lro_delay = kwargs.pop( 'polling_interval', @@ -200,27 +196,21 @@ async def begin_create_or_update( resource_group_name=resource_group_name, service_name=service_name, resource=resource, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_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) + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -232,6 +222,7 @@ def get_long_running_output(pipeline_response): ) 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( @@ -245,27 +236,17 @@ async def _delete_initial( 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 = build_delete_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -278,6 +259,8 @@ async def _delete_initial( _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}'} # type: ignore + + @distributed_trace_async async def begin_delete( self, resource_group_name: str, @@ -293,15 +276,17 @@ async def begin_delete( :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. + :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. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -315,21 +300,14 @@ async def begin_delete( 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) + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -341,6 +319,7 @@ def get_long_running_output(pipeline_response): ) 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( @@ -355,32 +334,22 @@ async def _update_initial( 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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = self._serialize.body(resource, 'ServiceResource') + + request = build_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + content_type=content_type, + json=_json, + template_url=self._update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -398,8 +367,11 @@ async def _update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}'} # type: ignore + + @distributed_trace_async async def begin_update( self, resource_group_name: str, @@ -418,15 +390,20 @@ async def begin_update( :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. + :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: + :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] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.ServiceResource"] lro_delay = kwargs.pop( 'polling_interval', @@ -438,27 +415,21 @@ async def begin_update( resource_group_name=resource_group_name, service_name=service_name, resource=resource, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_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) + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -470,8 +441,10 @@ def get_long_running_output(pipeline_response): ) 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 + @distributed_trace_async async def list_test_keys( self, resource_group_name: str, @@ -495,27 +468,17 @@ async def list_test_keys( 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 = build_list_test_keys_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + template_url=self.list_test_keys.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -529,8 +492,11 @@ async def list_test_keys( return cls(pipeline_response, deserialized, {}) return deserialized + list_test_keys.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/listTestKeys'} # type: ignore + + @distributed_trace_async async def regenerate_test_key( self, resource_group_name: str, @@ -546,7 +512,8 @@ async def regenerate_test_key( :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 + :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 @@ -557,32 +524,22 @@ async def regenerate_test_key( 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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = self._serialize.body(regenerate_test_key_request, 'RegenerateTestKeyRequestPayload') + + request = build_regenerate_test_key_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + content_type=content_type, + json=_json, + template_url=self.regenerate_test_key.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -596,8 +553,11 @@ async def regenerate_test_key( return cls(pipeline_response, deserialized, {}) return deserialized + regenerate_test_key.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/regenerateTestKey'} # type: ignore + + @distributed_trace_async async def disable_test_endpoint( self, resource_group_name: str, @@ -621,27 +581,17 @@ async def disable_test_endpoint( 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 = build_disable_test_endpoint_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + template_url=self.disable_test_endpoint.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -654,6 +604,8 @@ async def disable_test_endpoint( disable_test_endpoint.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/disableTestEndpoint'} # type: ignore + + @distributed_trace_async async def enable_test_endpoint( self, resource_group_name: str, @@ -677,27 +629,17 @@ async def enable_test_endpoint( 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 = build_enable_test_endpoint_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + template_url=self.enable_test_endpoint.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -711,8 +653,11 @@ async def enable_test_endpoint( return cls(pipeline_response, deserialized, {}) return deserialized + enable_test_endpoint.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/enableTestEndpoint'} # type: ignore + + @distributed_trace_async async def check_name_availability( self, location: str, @@ -724,7 +669,8 @@ async def check_name_availability( :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 + :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 @@ -735,31 +681,21 @@ async def check_name_availability( 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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = self._serialize.body(availability_parameters, 'NameAvailabilityParameters') + + request = build_check_name_availability_request( + subscription_id=self._config.subscription_id, + location=location, + content_type=content_type, + json=_json, + template_url=self.check_name_availability.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -773,8 +709,11 @@ async def check_name_availability( return cls(pipeline_response, deserialized, {}) return deserialized + check_name_availability.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.AppPlatform/locations/{location}/checkNameAvailability'} # type: ignore + + @distributed_trace def list_by_subscription( self, **kwargs: Any @@ -783,7 +722,8 @@ def list_by_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] + :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"] @@ -791,34 +731,29 @@ def list_by_subscription( 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) + + request = build_list_by_subscription_request( + subscription_id=self._config.subscription_id, + template_url=self.list_by_subscription.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_subscription_request( + subscription_id=self._config.subscription_id, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('ServiceResourceList', pipeline_response) + deserialized = self._deserialize("ServiceResourceList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -836,11 +771,13 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) list_by_subscription.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.AppPlatform/Spring'} # type: ignore + @distributed_trace def list( self, resource_group_name: str, @@ -853,7 +790,8 @@ def list( :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] + :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"] @@ -861,35 +799,31 @@ def list( 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) + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('ServiceResourceList', pipeline_response) + deserialized = self._deserialize("ServiceResourceList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -907,6 +841,7 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2021_06_01_preview/aio/operations/_skus_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2021_06_01_preview/aio/operations/_skus_operations.py index 8ed38802659b2..18e8dbf1ba0dc 100644 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2021_06_01_preview/aio/operations/_skus_operations.py +++ b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2021_06_01_preview/aio/operations/_skus_operations.py @@ -5,17 +5,22 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools 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.core.pipeline.transport import AsyncHttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._skus_operations import build_list_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -41,6 +46,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace def list( self, **kwargs: Any @@ -48,8 +54,10 @@ def list( """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] + :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"] @@ -57,34 +65,29 @@ def list( 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) + + request = build_list_request( + subscription_id=self._config.subscription_id, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('ResourceSkuCollection', pipeline_response) + deserialized = self._deserialize("ResourceSkuCollection", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -102,6 +105,7 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2021_06_01_preview/models/__init__.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2021_06_01_preview/models/__init__.py index 4fcc9dd5cc61a..b4d0f4adbb215 100644 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2021_06_01_preview/models/__init__.py +++ b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2021_06_01_preview/models/__init__.py @@ -154,6 +154,7 @@ from ._models import UserSourceInfo # type: ignore from ._app_platform_management_client_enums import ( + ActionType, AppResourceProvisioningState, ConfigServerState, DeploymentResourceProvisioningState, @@ -245,6 +246,7 @@ 'TestKeys', 'TrackedResource', 'UserSourceInfo', + 'ActionType', 'AppResourceProvisioningState', 'ConfigServerState', 'DeploymentResourceProvisioningState', diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2021_06_01_preview/models/_app_platform_management_client_enums.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2021_06_01_preview/models/_app_platform_management_client_enums.py index aa047f451ec59..fa72f83379ee7 100644 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2021_06_01_preview/models/_app_platform_management_client_enums.py +++ b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2021_06_01_preview/models/_app_platform_management_client_enums.py @@ -6,27 +6,18 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from enum import Enum, EnumMeta +from enum import Enum from six import with_metaclass +from azure.core import CaseInsensitiveEnumMeta -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 ActionType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): + """Enum. Indicates the action type. "Internal" refers to actions that are for internal only APIs. + """ + INTERNAL = "Internal" -class AppResourceProvisioningState(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class AppResourceProvisioningState(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Provisioning state of the App """ @@ -35,7 +26,7 @@ class AppResourceProvisioningState(with_metaclass(_CaseInsensitiveEnumMeta, str, CREATING = "Creating" UPDATING = "Updating" -class ConfigServerState(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class ConfigServerState(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """State of the config server. """ @@ -45,7 +36,7 @@ class ConfigServerState(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): SUCCEEDED = "Succeeded" UPDATING = "Updating" -class DeploymentResourceProvisioningState(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class DeploymentResourceProvisioningState(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Provisioning state of the Deployment """ @@ -54,7 +45,7 @@ class DeploymentResourceProvisioningState(with_metaclass(_CaseInsensitiveEnumMet SUCCEEDED = "Succeeded" FAILED = "Failed" -class DeploymentResourceStatus(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class DeploymentResourceStatus(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Status of the Deployment """ @@ -66,7 +57,7 @@ class DeploymentResourceStatus(with_metaclass(_CaseInsensitiveEnumMeta, str, Enu UPGRADING = "Upgrading" COMPILING = "Compiling" -class ManagedIdentityType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class ManagedIdentityType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Type of the managed identity """ @@ -75,7 +66,7 @@ class ManagedIdentityType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): USER_ASSIGNED = "UserAssigned" SYSTEM_ASSIGNED_USER_ASSIGNED = "SystemAssigned,UserAssigned" -class MonitoringSettingState(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class MonitoringSettingState(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """State of the Monitoring Setting. """ @@ -84,7 +75,7 @@ class MonitoringSettingState(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum) SUCCEEDED = "Succeeded" UPDATING = "Updating" -class ProvisioningState(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class ProvisioningState(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Provisioning state of the Service """ @@ -98,7 +89,7 @@ class ProvisioningState(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): MOVED = "Moved" MOVE_FAILED = "MoveFailed" -class ResourceSkuRestrictionsReasonCode(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class ResourceSkuRestrictionsReasonCode(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Gets the reason for restriction. Possible values include: 'QuotaId', 'NotAvailableForSubscription' """ @@ -106,14 +97,14 @@ class ResourceSkuRestrictionsReasonCode(with_metaclass(_CaseInsensitiveEnumMeta, QUOTA_ID = "QuotaId" NOT_AVAILABLE_FOR_SUBSCRIPTION = "NotAvailableForSubscription" -class ResourceSkuRestrictionsType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +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)): +class RuntimeVersion(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Runtime version """ @@ -121,7 +112,7 @@ class RuntimeVersion(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): JAVA11 = "Java_11" NET_CORE31 = "NetCore_31" -class SkuScaleType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class SkuScaleType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Gets or sets the type of the scale. """ @@ -129,14 +120,14 @@ class SkuScaleType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): MANUAL = "Manual" AUTOMATIC = "Automatic" -class SupportedRuntimePlatform(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +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)): +class SupportedRuntimeValue(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The raw value which could be passed to deployment CRUD operations. """ @@ -144,21 +135,21 @@ class SupportedRuntimeValue(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)) JAVA11 = "Java_11" NET_CORE31 = "NetCore_31" -class TestKeyType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class TestKeyType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Type of the test key """ PRIMARY = "Primary" SECONDARY = "Secondary" -class TrafficDirection(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class TrafficDirection(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The direction of required traffic """ INBOUND = "Inbound" OUTBOUND = "Outbound" -class UserSourceType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class UserSourceType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Type of the source uploaded """ diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2021_06_01_preview/models/_models.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2021_06_01_preview/models/_models.py index 0fff45f07e4ae..ac4c781fe46d2 100644 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2021_06_01_preview/models/_models.py +++ b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2021_06_01_preview/models/_models.py @@ -30,6 +30,8 @@ def __init__( self, **kwargs ): + """ + """ super(ApplicationInsightsAgentVersions, self).__init__(**kwargs) self.java = None @@ -63,6 +65,8 @@ def __init__( self, **kwargs ): + """ + """ super(Resource, self).__init__(**kwargs) self.id = None self.name = None @@ -98,6 +102,8 @@ def __init__( self, **kwargs ): + """ + """ super(ProxyResource, self).__init__(**kwargs) @@ -112,12 +118,12 @@ 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. - :type location: str + :ivar properties: Properties of the App resource. + :vartype properties: ~azure.mgmt.appplatform.v2021_06_01_preview.models.AppResourceProperties + :ivar identity: The Managed Identity type of the app resource. + :vartype identity: ~azure.mgmt.appplatform.v2021_06_01_preview.models.ManagedIdentityProperties + :ivar location: The GEO location of the application, always the same with its parent resource. + :vartype location: str """ _validation = { @@ -139,6 +145,16 @@ def __init__( self, **kwargs ): + """ + :keyword properties: Properties of the App resource. + :paramtype properties: ~azure.mgmt.appplatform.v2021_06_01_preview.models.AppResourceProperties + :keyword identity: The Managed Identity type of the app resource. + :paramtype identity: + ~azure.mgmt.appplatform.v2021_06_01_preview.models.ManagedIdentityProperties + :keyword location: The GEO location of the application, always the same with its parent + resource. + :paramtype location: str + """ super(AppResource, self).__init__(**kwargs) self.properties = kwargs.get('properties', None) self.identity = kwargs.get('identity', None) @@ -148,11 +164,11 @@ def __init__( 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). + :ivar value: Collection of App resources. + :vartype value: list[~azure.mgmt.appplatform.v2021_06_01_preview.models.AppResource] + :ivar 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 + :vartype next_link: str """ _attribute_map = { @@ -164,6 +180,13 @@ def __init__( self, **kwargs ): + """ + :keyword value: Collection of App resources. + :paramtype value: list[~azure.mgmt.appplatform.v2021_06_01_preview.models.AppResource] + :keyword next_link: URL client should use to fetch the next page (per server side paging). + It's null for now, added for future use. + :paramtype next_link: str + """ super(AppResourceCollection, self).__init__(**kwargs) self.value = kwargs.get('value', None) self.next_link = kwargs.get('next_link', None) @@ -174,28 +197,28 @@ class AppResourceProperties(msrest.serialization.Model): Variables are only populated by the server, and will be ignored when sending a request. - :param public: Indicates whether the App exposes public endpoint. - :type public: bool + :ivar public: Indicates whether the App exposes public endpoint. + :vartype public: bool :ivar url: URL of the App. :vartype url: str :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. - :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 active_deployment_name: Name of the active deployment of the App. + :vartype active_deployment_name: str + :ivar fqdn: Fully qualified dns Name. + :vartype fqdn: str + :ivar https_only: Indicate if only https is allowed. + :vartype https_only: bool :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 + :ivar temporary_disk: Temporary disk settings. + :vartype temporary_disk: ~azure.mgmt.appplatform.v2021_06_01_preview.models.TemporaryDisk + :ivar persistent_disk: Persistent disk settings. + :vartype persistent_disk: ~azure.mgmt.appplatform.v2021_06_01_preview.models.PersistentDisk + :ivar enable_end_to_end_tls: Indicate if end to end TLS is enabled. + :vartype enable_end_to_end_tls: bool """ _validation = { @@ -221,27 +244,43 @@ def __init__( self, **kwargs ): + """ + :keyword public: Indicates whether the App exposes public endpoint. + :paramtype public: bool + :keyword active_deployment_name: Name of the active deployment of the App. + :paramtype active_deployment_name: str + :keyword fqdn: Fully qualified dns Name. + :paramtype fqdn: str + :keyword https_only: Indicate if only https is allowed. + :paramtype https_only: bool + :keyword temporary_disk: Temporary disk settings. + :paramtype temporary_disk: ~azure.mgmt.appplatform.v2021_06_01_preview.models.TemporaryDisk + :keyword persistent_disk: Persistent disk settings. + :paramtype persistent_disk: ~azure.mgmt.appplatform.v2021_06_01_preview.models.PersistentDisk + :keyword enable_end_to_end_tls: Indicate if end to end TLS is enabled. + :paramtype enable_end_to_end_tls: bool + """ 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. - :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). + :ivar value: Collection of available operation details. + :vartype value: list[~azure.mgmt.appplatform.v2021_06_01_preview.models.OperationDetail] + :ivar 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 + :vartype next_link: str """ _attribute_map = { @@ -253,6 +292,13 @@ def __init__( self, **kwargs ): + """ + :keyword value: Collection of available operation details. + :paramtype value: list[~azure.mgmt.appplatform.v2021_06_01_preview.models.OperationDetail] + :keyword next_link: URL client should use to fetch the next page (per server side paging). + It's null for now, added for future use. + :paramtype next_link: str + """ super(AvailableOperations, self).__init__(**kwargs) self.value = kwargs.get('value', None) self.next_link = kwargs.get('next_link', None) @@ -280,6 +326,8 @@ def __init__( self, **kwargs ): + """ + """ super(AvailableRuntimeVersions, self).__init__(**kwargs) self.value = None @@ -295,8 +343,9 @@ 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 + :ivar properties: Properties of the Binding resource. + :vartype properties: + ~azure.mgmt.appplatform.v2021_06_01_preview.models.BindingResourceProperties """ _validation = { @@ -316,6 +365,11 @@ def __init__( self, **kwargs ): + """ + :keyword properties: Properties of the Binding resource. + :paramtype properties: + ~azure.mgmt.appplatform.v2021_06_01_preview.models.BindingResourceProperties + """ super(BindingResource, self).__init__(**kwargs) self.properties = kwargs.get('properties', None) @@ -323,11 +377,11 @@ def __init__( 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). + :ivar value: Collection of Binding resources. + :vartype value: list[~azure.mgmt.appplatform.v2021_06_01_preview.models.BindingResource] + :ivar 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 + :vartype next_link: str """ _attribute_map = { @@ -339,6 +393,13 @@ def __init__( self, **kwargs ): + """ + :keyword value: Collection of Binding resources. + :paramtype value: list[~azure.mgmt.appplatform.v2021_06_01_preview.models.BindingResource] + :keyword next_link: URL client should use to fetch the next page (per server side paging). + It's null for now, added for future use. + :paramtype next_link: str + """ super(BindingResourceCollection, self).__init__(**kwargs) self.value = kwargs.get('value', None) self.next_link = kwargs.get('next_link', None) @@ -353,12 +414,12 @@ class BindingResourceProperties(msrest.serialization.Model): :vartype resource_name: str :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. - :type resource_id: str - :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, any] + :ivar resource_id: The Azure resource id of the bound resource. + :vartype resource_id: str + :ivar key: The key of the bound resource. + :vartype key: str + :ivar binding_parameters: Binding parameters of the Binding resource. + :vartype 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 @@ -391,6 +452,14 @@ def __init__( self, **kwargs ): + """ + :keyword resource_id: The Azure resource id of the bound resource. + :paramtype resource_id: str + :keyword key: The key of the bound resource. + :paramtype key: str + :keyword binding_parameters: Binding parameters of the Binding resource. + :paramtype binding_parameters: dict[str, any] + """ super(BindingResourceProperties, self).__init__(**kwargs) self.resource_name = None self.resource_type = None @@ -411,12 +480,12 @@ class CertificateProperties(msrest.serialization.Model): :ivar thumbprint: The thumbprint of certificate. :vartype thumbprint: str - :param vault_uri: Required. The vault uri of user key vault. - :type vault_uri: str - :param key_vault_cert_name: Required. The certificate name of key vault. - :type key_vault_cert_name: str - :param cert_version: The certificate version of key vault. - :type cert_version: str + :ivar vault_uri: Required. The vault uri of user key vault. + :vartype vault_uri: str + :ivar key_vault_cert_name: Required. The certificate name of key vault. + :vartype key_vault_cert_name: str + :ivar cert_version: The certificate version of key vault. + :vartype cert_version: str :ivar issuer: The issuer of certificate. :vartype issuer: str :ivar issued_date: The issue date of certificate. @@ -460,6 +529,14 @@ def __init__( self, **kwargs ): + """ + :keyword vault_uri: Required. The vault uri of user key vault. + :paramtype vault_uri: str + :keyword key_vault_cert_name: Required. The certificate name of key vault. + :paramtype key_vault_cert_name: str + :keyword cert_version: The certificate version of key vault. + :paramtype cert_version: str + """ super(CertificateProperties, self).__init__(**kwargs) self.thumbprint = None self.vault_uri = kwargs['vault_uri'] @@ -484,8 +561,8 @@ class CertificateResource(ProxyResource): :vartype name: str :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 + :ivar properties: Properties of the certificate resource payload. + :vartype properties: ~azure.mgmt.appplatform.v2021_06_01_preview.models.CertificateProperties """ _validation = { @@ -505,6 +582,10 @@ def __init__( self, **kwargs ): + """ + :keyword properties: Properties of the certificate resource payload. + :paramtype properties: ~azure.mgmt.appplatform.v2021_06_01_preview.models.CertificateProperties + """ super(CertificateResource, self).__init__(**kwargs) self.properties = kwargs.get('properties', None) @@ -512,10 +593,10 @@ def __init__( class CertificateResourceCollection(msrest.serialization.Model): """Collection compose of certificate resources list and a possible link for next page. - :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 + :ivar value: The certificate resources list. + :vartype value: list[~azure.mgmt.appplatform.v2021_06_01_preview.models.CertificateResource] + :ivar next_link: The link to next page of certificate list. + :vartype next_link: str """ _attribute_map = { @@ -527,6 +608,12 @@ def __init__( self, **kwargs ): + """ + :keyword value: The certificate resources list. + :paramtype value: list[~azure.mgmt.appplatform.v2021_06_01_preview.models.CertificateResource] + :keyword next_link: The link to next page of certificate list. + :paramtype next_link: str + """ super(CertificateResourceCollection, self).__init__(**kwargs) self.value = kwargs.get('value', None) self.next_link = kwargs.get('next_link', None) @@ -535,17 +622,17 @@ def __init__( 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 + :ivar 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 + :vartype code: str + :ivar 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 + :vartype message: str + :ivar 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] + :vartype target: str + :ivar details: A list of additional details about the error. + :vartype details: list[~azure.mgmt.appplatform.v2021_06_01_preview.models.CloudErrorBody] """ _attribute_map = { @@ -559,6 +646,19 @@ def __init__( self, **kwargs ): + """ + :keyword code: An identifier for the error. Codes are invariant and are intended to be consumed + programmatically. + :paramtype code: str + :keyword message: A message describing the error, intended to be suitable for display in a user + interface. + :paramtype message: str + :keyword target: The target of the particular error. For example, the name of the property in + error. + :paramtype target: str + :keyword details: A list of additional details about the error. + :paramtype details: list[~azure.mgmt.appplatform.v2021_06_01_preview.models.CloudErrorBody] + """ super(CloudErrorBody, self).__init__(**kwargs) self.code = kwargs.get('code', None) self.message = kwargs.get('message', None) @@ -576,8 +676,8 @@ class ClusterResourceProperties(msrest.serialization.Model): "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 network_profile: Network profile of the Service. + :vartype 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. @@ -601,6 +701,10 @@ def __init__( self, **kwargs ): + """ + :keyword network_profile: Network profile of the Service. + :paramtype network_profile: ~azure.mgmt.appplatform.v2021_06_01_preview.models.NetworkProfile + """ super(ClusterResourceProperties, self).__init__(**kwargs) self.provisioning_state = None self.network_profile = kwargs.get('network_profile', None) @@ -613,27 +717,27 @@ class ConfigServerGitProperty(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param repositories: Repositories of git. - :type repositories: + :ivar repositories: Repositories of git. + :vartype repositories: list[~azure.mgmt.appplatform.v2021_06_01_preview.models.GitPatternRepository] - :param uri: Required. URI of the repository. - :type uri: str - :param label: Label of the repository. - :type label: str - :param search_paths: Searching path of the repository. - :type search_paths: list[str] - :param username: Username of git repository basic auth. - :type username: str - :param password: Password of git repository basic auth. - :type password: str - :param host_key: Public sshKey of git repository. - :type host_key: str - :param host_key_algorithm: SshKey algorithm of git repository. - :type host_key_algorithm: str - :param private_key: Private sshKey algorithm of git repository. - :type private_key: str - :param strict_host_key_checking: Strict host key checking or not. - :type strict_host_key_checking: bool + :ivar uri: Required. URI of the repository. + :vartype uri: str + :ivar label: Label of the repository. + :vartype label: str + :ivar search_paths: Searching path of the repository. + :vartype search_paths: list[str] + :ivar username: Username of git repository basic auth. + :vartype username: str + :ivar password: Password of git repository basic auth. + :vartype password: str + :ivar host_key: Public sshKey of git repository. + :vartype host_key: str + :ivar host_key_algorithm: SshKey algorithm of git repository. + :vartype host_key_algorithm: str + :ivar private_key: Private sshKey algorithm of git repository. + :vartype private_key: str + :ivar strict_host_key_checking: Strict host key checking or not. + :vartype strict_host_key_checking: bool """ _validation = { @@ -657,6 +761,29 @@ def __init__( self, **kwargs ): + """ + :keyword repositories: Repositories of git. + :paramtype repositories: + list[~azure.mgmt.appplatform.v2021_06_01_preview.models.GitPatternRepository] + :keyword uri: Required. URI of the repository. + :paramtype uri: str + :keyword label: Label of the repository. + :paramtype label: str + :keyword search_paths: Searching path of the repository. + :paramtype search_paths: list[str] + :keyword username: Username of git repository basic auth. + :paramtype username: str + :keyword password: Password of git repository basic auth. + :paramtype password: str + :keyword host_key: Public sshKey of git repository. + :paramtype host_key: str + :keyword host_key_algorithm: SshKey algorithm of git repository. + :paramtype host_key_algorithm: str + :keyword private_key: Private sshKey algorithm of git repository. + :paramtype private_key: str + :keyword strict_host_key_checking: Strict host key checking or not. + :paramtype strict_host_key_checking: bool + """ super(ConfigServerGitProperty, self).__init__(**kwargs) self.repositories = kwargs.get('repositories', None) self.uri = kwargs['uri'] @@ -679,10 +806,10 @@ class ConfigServerProperties(msrest.serialization.Model): "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 + :ivar error: Error when apply config server settings. + :vartype error: ~azure.mgmt.appplatform.v2021_06_01_preview.models.Error + :ivar config_server: Settings of config server. + :vartype config_server: ~azure.mgmt.appplatform.v2021_06_01_preview.models.ConfigServerSettings """ _validation = { @@ -699,6 +826,13 @@ def __init__( self, **kwargs ): + """ + :keyword error: Error when apply config server settings. + :paramtype error: ~azure.mgmt.appplatform.v2021_06_01_preview.models.Error + :keyword config_server: Settings of config server. + :paramtype config_server: + ~azure.mgmt.appplatform.v2021_06_01_preview.models.ConfigServerSettings + """ super(ConfigServerProperties, self).__init__(**kwargs) self.provisioning_state = None self.error = kwargs.get('error', None) @@ -716,8 +850,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 + :ivar properties: Properties of the Config Server resource. + :vartype properties: ~azure.mgmt.appplatform.v2021_06_01_preview.models.ConfigServerProperties """ _validation = { @@ -737,6 +871,11 @@ def __init__( self, **kwargs ): + """ + :keyword properties: Properties of the Config Server resource. + :paramtype properties: + ~azure.mgmt.appplatform.v2021_06_01_preview.models.ConfigServerProperties + """ super(ConfigServerResource, self).__init__(**kwargs) self.properties = kwargs.get('properties', None) @@ -744,8 +883,9 @@ def __init__( 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 + :ivar git_property: Property of git environment. + :vartype git_property: + ~azure.mgmt.appplatform.v2021_06_01_preview.models.ConfigServerGitProperty """ _attribute_map = { @@ -756,6 +896,11 @@ def __init__( self, **kwargs ): + """ + :keyword git_property: Property of git environment. + :paramtype git_property: + ~azure.mgmt.appplatform.v2021_06_01_preview.models.ConfigServerGitProperty + """ super(ConfigServerSettings, self).__init__(**kwargs) self.git_property = kwargs.get('git_property', None) @@ -763,12 +908,12 @@ def __init__( class ConfigServerSettingsErrorRecord(msrest.serialization.Model): """Error record of the config server settings. - :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. - :type uri: str - :param messages: The detail error messages of the record. - :type messages: list[str] + :ivar name: The name of the config server settings error record. + :vartype name: str + :ivar uri: The uri of the config server settings error record. + :vartype uri: str + :ivar messages: The detail error messages of the record. + :vartype messages: list[str] """ _attribute_map = { @@ -781,6 +926,14 @@ def __init__( self, **kwargs ): + """ + :keyword name: The name of the config server settings error record. + :paramtype name: str + :keyword uri: The uri of the config server settings error record. + :paramtype uri: str + :keyword messages: The detail error messages of the record. + :paramtype messages: list[str] + """ super(ConfigServerSettingsErrorRecord, self).__init__(**kwargs) self.name = kwargs.get('name', None) self.uri = kwargs.get('uri', None) @@ -790,10 +943,10 @@ def __init__( class ConfigServerSettingsValidateResult(msrest.serialization.Model): """Validation result for config server settings. - :param is_valid: Indicate if the config server settings are valid. - :type is_valid: bool - :param details: The detail validation results. - :type details: + :ivar is_valid: Indicate if the config server settings are valid. + :vartype is_valid: bool + :ivar details: The detail validation results. + :vartype details: list[~azure.mgmt.appplatform.v2021_06_01_preview.models.ConfigServerSettingsErrorRecord] """ @@ -806,6 +959,13 @@ def __init__( self, **kwargs ): + """ + :keyword is_valid: Indicate if the config server settings are valid. + :paramtype is_valid: bool + :keyword details: The detail validation results. + :paramtype details: + list[~azure.mgmt.appplatform.v2021_06_01_preview.models.ConfigServerSettingsErrorRecord] + """ super(ConfigServerSettingsValidateResult, self).__init__(**kwargs) self.is_valid = kwargs.get('is_valid', None) self.details = kwargs.get('details', None) @@ -814,19 +974,19 @@ def __init__( 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 + :ivar server: The name of the registry that contains the container image. + :vartype server: str + :ivar 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 + :vartype container_image: str + :ivar 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 + :vartype command: list[str] + :ivar 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: + :vartype args: list[str] + :ivar image_registry_credential: Credential of the image registry. + :vartype image_registry_credential: ~azure.mgmt.appplatform.v2021_06_01_preview.models.ImageRegistryCredential """ @@ -842,6 +1002,22 @@ def __init__( self, **kwargs ): + """ + :keyword server: The name of the registry that contains the container image. + :paramtype server: str + :keyword container_image: Container image of the custom container. This should be in the form + of :code:``::code:`` without the server name of the registry. + :paramtype container_image: str + :keyword command: Entrypoint array. Not executed within a shell. The docker image's ENTRYPOINT + is used if this is not provided. + :paramtype command: list[str] + :keyword args: Arguments to the entrypoint. The docker image's CMD is used if this is not + provided. + :paramtype args: list[str] + :keyword image_registry_credential: Credential of the image registry. + :paramtype image_registry_credential: + ~azure.mgmt.appplatform.v2021_06_01_preview.models.ImageRegistryCredential + """ super(CustomContainer, self).__init__(**kwargs) self.server = kwargs.get('server', None) self.container_image = kwargs.get('container_image', None) @@ -855,12 +1031,12 @@ class CustomDomainProperties(msrest.serialization.Model): 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 + :ivar thumbprint: The thumbprint of bound certificate. + :vartype thumbprint: str :ivar app_name: The app name of domain. :vartype app_name: str - :param cert_name: The bound certificate name of domain. - :type cert_name: str + :ivar cert_name: The bound certificate name of domain. + :vartype cert_name: str """ _validation = { @@ -877,6 +1053,12 @@ def __init__( self, **kwargs ): + """ + :keyword thumbprint: The thumbprint of bound certificate. + :paramtype thumbprint: str + :keyword cert_name: The bound certificate name of domain. + :paramtype cert_name: str + """ super(CustomDomainProperties, self).__init__(**kwargs) self.thumbprint = kwargs.get('thumbprint', None) self.app_name = None @@ -894,8 +1076,8 @@ class CustomDomainResource(ProxyResource): :vartype name: str :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 + :ivar properties: Properties of the custom domain resource. + :vartype properties: ~azure.mgmt.appplatform.v2021_06_01_preview.models.CustomDomainProperties """ _validation = { @@ -915,6 +1097,11 @@ def __init__( self, **kwargs ): + """ + :keyword properties: Properties of the custom domain resource. + :paramtype properties: + ~azure.mgmt.appplatform.v2021_06_01_preview.models.CustomDomainProperties + """ super(CustomDomainResource, self).__init__(**kwargs) self.properties = kwargs.get('properties', None) @@ -922,10 +1109,10 @@ def __init__( 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 + :ivar value: The custom domain resources list. + :vartype value: list[~azure.mgmt.appplatform.v2021_06_01_preview.models.CustomDomainResource] + :ivar next_link: The link to next page of custom domain list. + :vartype next_link: str """ _attribute_map = { @@ -937,6 +1124,12 @@ def __init__( self, **kwargs ): + """ + :keyword value: The custom domain resources list. + :paramtype value: list[~azure.mgmt.appplatform.v2021_06_01_preview.models.CustomDomainResource] + :keyword next_link: The link to next page of custom domain list. + :paramtype next_link: str + """ super(CustomDomainResourceCollection, self).__init__(**kwargs) self.value = kwargs.get('value', None) self.next_link = kwargs.get('next_link', None) @@ -947,8 +1140,8 @@ class CustomDomainValidatePayload(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param name: Required. Name to be validated. - :type name: str + :ivar name: Required. Name to be validated. + :vartype name: str """ _validation = { @@ -963,6 +1156,10 @@ def __init__( self, **kwargs ): + """ + :keyword name: Required. Name to be validated. + :paramtype name: str + """ super(CustomDomainValidatePayload, self).__init__(**kwargs) self.name = kwargs['name'] @@ -970,10 +1167,10 @@ def __init__( class CustomDomainValidateResult(msrest.serialization.Model): """Validation result for custom domain. - :param is_valid: Indicates if domain name is valid. - :type is_valid: bool - :param message: Message of why domain name is invalid. - :type message: str + :ivar is_valid: Indicates if domain name is valid. + :vartype is_valid: bool + :ivar message: Message of why domain name is invalid. + :vartype message: str """ _attribute_map = { @@ -985,6 +1182,12 @@ def __init__( self, **kwargs ): + """ + :keyword is_valid: Indicates if domain name is valid. + :paramtype is_valid: bool + :keyword message: Message of why domain name is invalid. + :paramtype message: str + """ super(CustomDomainValidateResult, self).__init__(**kwargs) self.is_valid = kwargs.get('is_valid', None) self.message = kwargs.get('message', None) @@ -1027,6 +1230,8 @@ def __init__( self, **kwargs ): + """ + """ super(DeploymentInstance, self).__init__(**kwargs) self.name = None self.status = None @@ -1046,11 +1251,11 @@ 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: + :ivar properties: Properties of the Deployment resource. + :vartype 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 + :ivar sku: Sku of the Deployment resource. + :vartype sku: ~azure.mgmt.appplatform.v2021_06_01_preview.models.Sku """ _validation = { @@ -1071,6 +1276,13 @@ def __init__( self, **kwargs ): + """ + :keyword properties: Properties of the Deployment resource. + :paramtype properties: + ~azure.mgmt.appplatform.v2021_06_01_preview.models.DeploymentResourceProperties + :keyword sku: Sku of the Deployment resource. + :paramtype sku: ~azure.mgmt.appplatform.v2021_06_01_preview.models.Sku + """ super(DeploymentResource, self).__init__(**kwargs) self.properties = kwargs.get('properties', None) self.sku = kwargs.get('sku', None) @@ -1079,11 +1291,11 @@ def __init__( 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). + :ivar value: Collection of Deployment resources. + :vartype value: list[~azure.mgmt.appplatform.v2021_06_01_preview.models.DeploymentResource] + :ivar 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 + :vartype next_link: str """ _attribute_map = { @@ -1095,6 +1307,13 @@ def __init__( self, **kwargs ): + """ + :keyword value: Collection of Deployment resources. + :paramtype value: list[~azure.mgmt.appplatform.v2021_06_01_preview.models.DeploymentResource] + :keyword next_link: URL client should use to fetch the next page (per server side paging). + It's null for now, added for future use. + :paramtype next_link: str + """ super(DeploymentResourceCollection, self).__init__(**kwargs) self.value = kwargs.get('value', None) self.next_link = kwargs.get('next_link', None) @@ -1105,12 +1324,12 @@ class DeploymentResourceProperties(msrest.serialization.Model): 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 source: Uploaded source information of the deployment. + :vartype 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. - :type deployment_settings: + :ivar deployment_settings: Deployment settings of the Deployment. + :vartype 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". @@ -1152,6 +1371,13 @@ def __init__( self, **kwargs ): + """ + :keyword source: Uploaded source information of the deployment. + :paramtype source: ~azure.mgmt.appplatform.v2021_06_01_preview.models.UserSourceInfo + :keyword deployment_settings: Deployment settings of the Deployment. + :paramtype deployment_settings: + ~azure.mgmt.appplatform.v2021_06_01_preview.models.DeploymentSettings + """ super(DeploymentResourceProperties, self).__init__(**kwargs) self.source = kwargs.get('source', None) self.app_name = None @@ -1166,27 +1392,28 @@ def __init__( 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 + :ivar 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, + :vartype cpu: int + :ivar 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 + :vartype memory_in_gb: int + :ivar 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. - :type net_core_main_entry_path: str - :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 + :vartype resource_requests: ~azure.mgmt.appplatform.v2021_06_01_preview.models.ResourceRequests + :ivar jvm_options: JVM parameter. + :vartype jvm_options: str + :ivar net_core_main_entry_path: The path to the .NET executable relative to zip root. + :vartype net_core_main_entry_path: str + :ivar environment_variables: Collection of environment variables. + :vartype environment_variables: dict[str, str] + :ivar runtime_version: Runtime version. Possible values include: "Java_8", "Java_11", + "NetCore_31". Default value: "Java_8". + :vartype runtime_version: str or + ~azure.mgmt.appplatform.v2021_06_01_preview.models.RuntimeVersion """ _attribute_map = { @@ -1203,6 +1430,31 @@ def __init__( self, **kwargs ): + """ + :keyword 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. + :paramtype cpu: int + :keyword 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. + :paramtype memory_in_gb: int + :keyword 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. + :paramtype resource_requests: + ~azure.mgmt.appplatform.v2021_06_01_preview.models.ResourceRequests + :keyword jvm_options: JVM parameter. + :paramtype jvm_options: str + :keyword net_core_main_entry_path: The path to the .NET executable relative to zip root. + :paramtype net_core_main_entry_path: str + :keyword environment_variables: Collection of environment variables. + :paramtype environment_variables: dict[str, str] + :keyword runtime_version: Runtime version. Possible values include: "Java_8", "Java_11", + "NetCore_31". Default value: "Java_8". + :paramtype runtime_version: str or + ~azure.mgmt.appplatform.v2021_06_01_preview.models.RuntimeVersion + """ super(DeploymentSettings, self).__init__(**kwargs) self.cpu = kwargs.get('cpu', 1) self.memory_in_gb = kwargs.get('memory_in_gb', 1) @@ -1210,16 +1462,16 @@ def __init__( 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(msrest.serialization.Model): """The error code compose of code and message. - :param code: The code of error. - :type code: str - :param message: The message of error. - :type message: str + :ivar code: The code of error. + :vartype code: str + :ivar message: The message of error. + :vartype message: str """ _attribute_map = { @@ -1231,6 +1483,12 @@ def __init__( self, **kwargs ): + """ + :keyword code: The code of error. + :paramtype code: str + :keyword message: The message of error. + :paramtype message: str + """ super(Error, self).__init__(**kwargs) self.code = kwargs.get('code', None) self.message = kwargs.get('message', None) @@ -1241,28 +1499,28 @@ class GitPatternRepository(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param name: Required. Name of the repository. - :type name: str - :param pattern: Collection of pattern of the repository. - :type pattern: list[str] - :param uri: Required. URI of the repository. - :type uri: str - :param label: Label of the repository. - :type label: str - :param search_paths: Searching path of the repository. - :type search_paths: list[str] - :param username: Username of git repository basic auth. - :type username: str - :param password: Password of git repository basic auth. - :type password: str - :param host_key: Public sshKey of git repository. - :type host_key: str - :param host_key_algorithm: SshKey algorithm of git repository. - :type host_key_algorithm: str - :param private_key: Private sshKey algorithm of git repository. - :type private_key: str - :param strict_host_key_checking: Strict host key checking or not. - :type strict_host_key_checking: bool + :ivar name: Required. Name of the repository. + :vartype name: str + :ivar pattern: Collection of pattern of the repository. + :vartype pattern: list[str] + :ivar uri: Required. URI of the repository. + :vartype uri: str + :ivar label: Label of the repository. + :vartype label: str + :ivar search_paths: Searching path of the repository. + :vartype search_paths: list[str] + :ivar username: Username of git repository basic auth. + :vartype username: str + :ivar password: Password of git repository basic auth. + :vartype password: str + :ivar host_key: Public sshKey of git repository. + :vartype host_key: str + :ivar host_key_algorithm: SshKey algorithm of git repository. + :vartype host_key_algorithm: str + :ivar private_key: Private sshKey algorithm of git repository. + :vartype private_key: str + :ivar strict_host_key_checking: Strict host key checking or not. + :vartype strict_host_key_checking: bool """ _validation = { @@ -1288,6 +1546,30 @@ def __init__( self, **kwargs ): + """ + :keyword name: Required. Name of the repository. + :paramtype name: str + :keyword pattern: Collection of pattern of the repository. + :paramtype pattern: list[str] + :keyword uri: Required. URI of the repository. + :paramtype uri: str + :keyword label: Label of the repository. + :paramtype label: str + :keyword search_paths: Searching path of the repository. + :paramtype search_paths: list[str] + :keyword username: Username of git repository basic auth. + :paramtype username: str + :keyword password: Password of git repository basic auth. + :paramtype password: str + :keyword host_key: Public sshKey of git repository. + :paramtype host_key: str + :keyword host_key_algorithm: SshKey algorithm of git repository. + :paramtype host_key_algorithm: str + :keyword private_key: Private sshKey algorithm of git repository. + :paramtype private_key: str + :keyword strict_host_key_checking: Strict host key checking or not. + :paramtype strict_host_key_checking: bool + """ super(GitPatternRepository, self).__init__(**kwargs) self.name = kwargs['name'] self.pattern = kwargs.get('pattern', None) @@ -1305,10 +1587,10 @@ def __init__( 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 + :ivar username: The username of the image registry credential. + :vartype username: str + :ivar password: The password of the image registry credential. + :vartype password: str """ _attribute_map = { @@ -1320,6 +1602,12 @@ def __init__( self, **kwargs ): + """ + :keyword username: The username of the image registry credential. + :paramtype username: str + :keyword password: The password of the image registry credential. + :paramtype password: str + """ super(ImageRegistryCredential, self).__init__(**kwargs) self.username = kwargs.get('username', None) self.password = kwargs.get('password', None) @@ -1330,8 +1618,8 @@ class LogFileUrlResponse(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param url: Required. URL of the log file. - :type url: str + :ivar url: Required. URL of the log file. + :vartype url: str """ _validation = { @@ -1346,6 +1634,10 @@ def __init__( self, **kwargs ): + """ + :keyword url: Required. URL of the log file. + :paramtype url: str + """ super(LogFileUrlResponse, self).__init__(**kwargs) self.url = kwargs['url'] @@ -1353,12 +1645,12 @@ def __init__( class LogSpecification(msrest.serialization.Model): """Specifications of the Log for Azure Monitoring. - :param name: Name of the log. - :type name: str - :param display_name: Localized friendly display name of the log. - :type display_name: str - :param blob_duration: Blob duration of the log. - :type blob_duration: str + :ivar name: Name of the log. + :vartype name: str + :ivar display_name: Localized friendly display name of the log. + :vartype display_name: str + :ivar blob_duration: Blob duration of the log. + :vartype blob_duration: str """ _attribute_map = { @@ -1371,6 +1663,14 @@ def __init__( self, **kwargs ): + """ + :keyword name: Name of the log. + :paramtype name: str + :keyword display_name: Localized friendly display name of the log. + :paramtype display_name: str + :keyword blob_duration: Blob duration of the log. + :paramtype blob_duration: str + """ super(LogSpecification, self).__init__(**kwargs) self.name = kwargs.get('name', None) self.display_name = kwargs.get('display_name', None) @@ -1380,13 +1680,13 @@ def __init__( 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", + :ivar 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. - :type tenant_id: str + :vartype type: str or ~azure.mgmt.appplatform.v2021_06_01_preview.models.ManagedIdentityType + :ivar principal_id: Principal Id. + :vartype principal_id: str + :ivar tenant_id: Tenant Id. + :vartype tenant_id: str """ _attribute_map = { @@ -1399,6 +1699,15 @@ def __init__( self, **kwargs ): + """ + :keyword type: Type of the managed identity. Possible values include: "None", "SystemAssigned", + "UserAssigned", "SystemAssigned,UserAssigned". + :paramtype type: str or ~azure.mgmt.appplatform.v2021_06_01_preview.models.ManagedIdentityType + :keyword principal_id: Principal Id. + :paramtype principal_id: str + :keyword tenant_id: Tenant Id. + :paramtype tenant_id: str + """ super(ManagedIdentityProperties, self).__init__(**kwargs) self.type = kwargs.get('type', None) self.principal_id = kwargs.get('principal_id', None) @@ -1408,13 +1717,13 @@ def __init__( class MetricDimension(msrest.serialization.Model): """Specifications of the Dimension of metrics. - :param name: Name of the dimension. - :type name: str - :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 + :ivar name: Name of the dimension. + :vartype name: str + :ivar display_name: Localized friendly display name of the dimension. + :vartype display_name: str + :ivar to_be_exported_for_shoebox: Whether this dimension should be included for the Shoebox export scenario. - :type to_be_exported_for_shoebox: bool + :vartype to_be_exported_for_shoebox: bool """ _attribute_map = { @@ -1427,6 +1736,15 @@ def __init__( self, **kwargs ): + """ + :keyword name: Name of the dimension. + :paramtype name: str + :keyword display_name: Localized friendly display name of the dimension. + :paramtype display_name: str + :keyword to_be_exported_for_shoebox: Whether this dimension should be included for the Shoebox + export scenario. + :paramtype to_be_exported_for_shoebox: bool + """ super(MetricDimension, self).__init__(**kwargs) self.name = kwargs.get('name', None) self.display_name = kwargs.get('display_name', None) @@ -1436,29 +1754,31 @@ def __init__( class MetricSpecification(msrest.serialization.Model): """Specifications of the Metrics for Azure Monitoring. - :param name: Name of the metric. - :type name: str - :param display_name: Localized friendly display name of the metric. - :type display_name: str - :param display_description: Localized friendly description of the metric. - :type display_description: str - :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 + :ivar name: Name of the metric. + :vartype name: str + :ivar display_name: Localized friendly display name of the metric. + :vartype display_name: str + :ivar display_description: Localized friendly description of the metric. + :vartype display_description: str + :ivar unit: Unit that makes sense for the metric. + :vartype unit: str + :ivar 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, + :vartype category: str + :ivar 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. - :type supported_aggregation_types: list[str] - :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 + :vartype aggregation_type: str + :ivar supported_aggregation_types: Supported aggregation types. + :vartype supported_aggregation_types: list[str] + :ivar supported_time_grain_types: Supported time grain types. + :vartype supported_time_grain_types: list[str] + :ivar 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] + :vartype fill_gap_with_zero: bool + :ivar dimensions: Dimensions of the metric. + :vartype dimensions: list[~azure.mgmt.appplatform.v2021_06_01_preview.models.MetricDimension] + :ivar source_mdm_namespace: Name of the MDM namespace. Optional. + :vartype source_mdm_namespace: str """ _attribute_map = { @@ -1472,12 +1792,40 @@ class MetricSpecification(msrest.serialization.Model): 'supported_time_grain_types': {'key': 'supportedTimeGrainTypes', 'type': '[str]'}, 'fill_gap_with_zero': {'key': 'fillGapWithZero', 'type': 'bool'}, 'dimensions': {'key': 'dimensions', 'type': '[MetricDimension]'}, - } - - def __init__( - self, - **kwargs - ): + 'source_mdm_namespace': {'key': 'sourceMdmNamespace', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + """ + :keyword name: Name of the metric. + :paramtype name: str + :keyword display_name: Localized friendly display name of the metric. + :paramtype display_name: str + :keyword display_description: Localized friendly description of the metric. + :paramtype display_description: str + :keyword unit: Unit that makes sense for the metric. + :paramtype unit: str + :keyword category: Name of the metric category that the metric belongs to. A metric can only + belong to a single category. + :paramtype category: str + :keyword aggregation_type: Only provide one value for this field. Valid values: Average, + Minimum, Maximum, Total, Count. + :paramtype aggregation_type: str + :keyword supported_aggregation_types: Supported aggregation types. + :paramtype supported_aggregation_types: list[str] + :keyword supported_time_grain_types: Supported time grain types. + :paramtype supported_time_grain_types: list[str] + :keyword fill_gap_with_zero: Optional. If set to true, then zero will be returned for time + duration where no metric is emitted/published. + :paramtype fill_gap_with_zero: bool + :keyword dimensions: Dimensions of the metric. + :paramtype dimensions: list[~azure.mgmt.appplatform.v2021_06_01_preview.models.MetricDimension] + :keyword source_mdm_namespace: Name of the MDM namespace. Optional. + :paramtype source_mdm_namespace: str + """ super(MetricSpecification, self).__init__(**kwargs) self.name = kwargs.get('name', None) self.display_name = kwargs.get('display_name', None) @@ -1489,6 +1837,7 @@ def __init__( self.supported_time_grain_types = kwargs.get('supported_time_grain_types', None) self.fill_gap_with_zero = kwargs.get('fill_gap_with_zero', None) self.dimensions = kwargs.get('dimensions', None) + self.source_mdm_namespace = kwargs.get('source_mdm_namespace', None) class MonitoringSettingProperties(msrest.serialization.Model): @@ -1500,20 +1849,20 @@ class MonitoringSettingProperties(msrest.serialization.Model): "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. - :type trace_enabled: bool - :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, + :ivar error: Error when apply Monitoring Setting changes. + :vartype error: ~azure.mgmt.appplatform.v2021_06_01_preview.models.Error + :ivar 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. + :vartype trace_enabled: bool + :ivar app_insights_instrumentation_key: Target application insight instrumentation key, null or + whitespace include empty will disable monitoringSettings. + :vartype app_insights_instrumentation_key: str + :ivar 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. - :type app_insights_agent_versions: + :vartype app_insights_sampling_rate: float + :ivar app_insights_agent_versions: Indicates the versions of application insight agent. + :vartype app_insights_agent_versions: ~azure.mgmt.appplatform.v2021_06_01_preview.models.ApplicationInsightsAgentVersions """ @@ -1535,6 +1884,23 @@ def __init__( self, **kwargs ): + """ + :keyword error: Error when apply Monitoring Setting changes. + :paramtype error: ~azure.mgmt.appplatform.v2021_06_01_preview.models.Error + :keyword 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. + :paramtype trace_enabled: bool + :keyword app_insights_instrumentation_key: Target application insight instrumentation key, null + or whitespace include empty will disable monitoringSettings. + :paramtype app_insights_instrumentation_key: str + :keyword app_insights_sampling_rate: Indicates the sampling rate of application insight agent, + should be in range [0.0, 100.0]. + :paramtype app_insights_sampling_rate: float + :keyword app_insights_agent_versions: Indicates the versions of application insight agent. + :paramtype app_insights_agent_versions: + ~azure.mgmt.appplatform.v2021_06_01_preview.models.ApplicationInsightsAgentVersions + """ super(MonitoringSettingProperties, self).__init__(**kwargs) self.provisioning_state = None self.error = kwargs.get('error', None) @@ -1555,8 +1921,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: + :ivar properties: Properties of the Monitoring Setting resource. + :vartype properties: ~azure.mgmt.appplatform.v2021_06_01_preview.models.MonitoringSettingProperties """ @@ -1577,6 +1943,11 @@ def __init__( self, **kwargs ): + """ + :keyword properties: Properties of the Monitoring Setting resource. + :paramtype properties: + ~azure.mgmt.appplatform.v2021_06_01_preview.models.MonitoringSettingProperties + """ super(MonitoringSettingResource, self).__init__(**kwargs) self.properties = kwargs.get('properties', None) @@ -1584,12 +1955,12 @@ def __init__( class NameAvailability(msrest.serialization.Model): """Name availability result payload. - :param name_available: Indicates whether the name is available. - :type name_available: bool - :param reason: Reason why the name is not available. - :type reason: str - :param message: Message why the name is not available. - :type message: str + :ivar name_available: Indicates whether the name is available. + :vartype name_available: bool + :ivar reason: Reason why the name is not available. + :vartype reason: str + :ivar message: Message why the name is not available. + :vartype message: str """ _attribute_map = { @@ -1602,6 +1973,14 @@ def __init__( self, **kwargs ): + """ + :keyword name_available: Indicates whether the name is available. + :paramtype name_available: bool + :keyword reason: Reason why the name is not available. + :paramtype reason: str + :keyword message: Message why the name is not available. + :paramtype message: str + """ super(NameAvailability, self).__init__(**kwargs) self.name_available = kwargs.get('name_available', None) self.reason = kwargs.get('reason', None) @@ -1613,10 +1992,10 @@ class NameAvailabilityParameters(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param type: Required. Type of the resource to check name availability. - :type type: str - :param name: Required. Name to be checked. - :type name: str + :ivar type: Required. Type of the resource to check name availability. + :vartype type: str + :ivar name: Required. Name to be checked. + :vartype name: str """ _validation = { @@ -1633,6 +2012,12 @@ def __init__( self, **kwargs ): + """ + :keyword type: Required. Type of the resource to check name availability. + :paramtype type: str + :keyword name: Required. Name to be checked. + :paramtype name: str + """ super(NameAvailabilityParameters, self).__init__(**kwargs) self.type = kwargs['type'] self.name = kwargs['name'] @@ -1643,20 +2028,19 @@ class NetworkProfile(msrest.serialization.Model): 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. - :type service_runtime_subnet_id: str - :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. - :type service_cidr: str - :param service_runtime_network_resource_group: Name of the resource group containing network + :ivar service_runtime_subnet_id: Fully qualified resource Id of the subnet to host Azure Spring + Cloud Service Runtime. + :vartype service_runtime_subnet_id: str + :ivar app_subnet_id: Fully qualified resource Id of the subnet to host Azure Spring Cloud Apps. + :vartype app_subnet_id: str + :ivar service_cidr: Azure Spring Cloud service reserved CIDR. + :vartype service_cidr: str + :ivar 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 + :vartype service_runtime_network_resource_group: str + :ivar app_network_resource_group: Name of the resource group containing network resources of Azure Spring Cloud Apps. - :type app_network_resource_group: str + :vartype app_network_resource_group: str :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 @@ -1684,6 +2068,22 @@ def __init__( self, **kwargs ): + """ + :keyword service_runtime_subnet_id: Fully qualified resource Id of the subnet to host Azure + Spring Cloud Service Runtime. + :paramtype service_runtime_subnet_id: str + :keyword app_subnet_id: Fully qualified resource Id of the subnet to host Azure Spring Cloud + Apps. + :paramtype app_subnet_id: str + :keyword service_cidr: Azure Spring Cloud service reserved CIDR. + :paramtype service_cidr: str + :keyword service_runtime_network_resource_group: Name of the resource group containing network + resources of Azure Spring Cloud Service Runtime. + :paramtype service_runtime_network_resource_group: str + :keyword app_network_resource_group: Name of the resource group containing network resources of + Azure Spring Cloud Apps. + :paramtype app_network_resource_group: str + """ 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) @@ -1715,6 +2115,8 @@ def __init__( self, **kwargs ): + """ + """ super(NetworkProfileOutboundIPs, self).__init__(**kwargs) self.public_i_ps = None @@ -1722,22 +2124,32 @@ def __init__( class OperationDetail(msrest.serialization.Model): """Operation detail payload. - :param name: Name of the operation. - :type name: str - :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. - :type origin: str - :param properties: Properties of the operation. - :type properties: ~azure.mgmt.appplatform.v2021_06_01_preview.models.OperationProperties + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar name: Name of the operation. + :vartype name: str + :ivar is_data_action: Indicates whether the operation is a data action. + :vartype is_data_action: bool + :ivar display: Display of the operation. + :vartype display: ~azure.mgmt.appplatform.v2021_06_01_preview.models.OperationDisplay + :ivar action_type: Enum. Indicates the action type. "Internal" refers to actions that are for + internal only APIs. Possible values include: "Internal". + :vartype action_type: str or ~azure.mgmt.appplatform.v2021_06_01_preview.models.ActionType + :ivar origin: Origin of the operation. + :vartype origin: str + :ivar properties: Properties of the operation. + :vartype properties: ~azure.mgmt.appplatform.v2021_06_01_preview.models.OperationProperties """ + _validation = { + 'action_type': {'readonly': True}, + } + _attribute_map = { 'name': {'key': 'name', 'type': 'str'}, 'is_data_action': {'key': 'isDataAction', 'type': 'bool'}, 'display': {'key': 'display', 'type': 'OperationDisplay'}, + 'action_type': {'key': 'actionType', 'type': 'str'}, 'origin': {'key': 'origin', 'type': 'str'}, 'properties': {'key': 'properties', 'type': 'OperationProperties'}, } @@ -1746,10 +2158,23 @@ def __init__( self, **kwargs ): + """ + :keyword name: Name of the operation. + :paramtype name: str + :keyword is_data_action: Indicates whether the operation is a data action. + :paramtype is_data_action: bool + :keyword display: Display of the operation. + :paramtype display: ~azure.mgmt.appplatform.v2021_06_01_preview.models.OperationDisplay + :keyword origin: Origin of the operation. + :paramtype origin: str + :keyword properties: Properties of the operation. + :paramtype properties: ~azure.mgmt.appplatform.v2021_06_01_preview.models.OperationProperties + """ super(OperationDetail, self).__init__(**kwargs) self.name = kwargs.get('name', None) self.is_data_action = kwargs.get('is_data_action', None) self.display = kwargs.get('display', None) + self.action_type = None self.origin = kwargs.get('origin', None) self.properties = kwargs.get('properties', None) @@ -1757,14 +2182,14 @@ def __init__( class OperationDisplay(msrest.serialization.Model): """Operation display payload. - :param provider: Resource provider of the operation. - :type provider: str - :param resource: Resource of the operation. - :type resource: str - :param operation: Localized friendly name for the operation. - :type operation: str - :param description: Localized friendly description for the operation. - :type description: str + :ivar provider: Resource provider of the operation. + :vartype provider: str + :ivar resource: Resource of the operation. + :vartype resource: str + :ivar operation: Localized friendly name for the operation. + :vartype operation: str + :ivar description: Localized friendly description for the operation. + :vartype description: str """ _attribute_map = { @@ -1778,6 +2203,16 @@ def __init__( self, **kwargs ): + """ + :keyword provider: Resource provider of the operation. + :paramtype provider: str + :keyword resource: Resource of the operation. + :paramtype resource: str + :keyword operation: Localized friendly name for the operation. + :paramtype operation: str + :keyword description: Localized friendly description for the operation. + :paramtype description: str + """ super(OperationDisplay, self).__init__(**kwargs) self.provider = kwargs.get('provider', None) self.resource = kwargs.get('resource', None) @@ -1788,8 +2223,8 @@ def __init__( class OperationProperties(msrest.serialization.Model): """Extra Operation properties. - :param service_specification: Service specifications of the operation. - :type service_specification: + :ivar service_specification: Service specifications of the operation. + :vartype service_specification: ~azure.mgmt.appplatform.v2021_06_01_preview.models.ServiceSpecification """ @@ -1801,6 +2236,11 @@ def __init__( self, **kwargs ): + """ + :keyword service_specification: Service specifications of the operation. + :paramtype service_specification: + ~azure.mgmt.appplatform.v2021_06_01_preview.models.ServiceSpecification + """ super(OperationProperties, self).__init__(**kwargs) self.service_specification = kwargs.get('service_specification', None) @@ -1810,12 +2250,12 @@ class PersistentDisk(msrest.serialization.Model): 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. - :type size_in_gb: int + :ivar size_in_gb: Size of the persistent disk in GB. + :vartype size_in_gb: int :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. - :type mount_path: str + :ivar mount_path: Mount path of the persistent disk. + :vartype mount_path: str """ _validation = { @@ -1833,6 +2273,12 @@ def __init__( self, **kwargs ): + """ + :keyword size_in_gb: Size of the persistent disk in GB. + :paramtype size_in_gb: int + :keyword mount_path: Mount path of the persistent disk. + :paramtype mount_path: str + """ super(PersistentDisk, self).__init__(**kwargs) self.size_in_gb = kwargs.get('size_in_gb', None) self.used_in_gb = None @@ -1844,9 +2290,9 @@ class RegenerateTestKeyRequestPayload(msrest.serialization.Model): 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", + :ivar 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 + :vartype key_type: str or ~azure.mgmt.appplatform.v2021_06_01_preview.models.TestKeyType """ _validation = { @@ -1861,6 +2307,11 @@ def __init__( self, **kwargs ): + """ + :keyword key_type: Required. Type of the test key. Possible values include: "Primary", + "Secondary". + :paramtype key_type: str or ~azure.mgmt.appplatform.v2021_06_01_preview.models.TestKeyType + """ super(RegenerateTestKeyRequestPayload, self).__init__(**kwargs) self.key_type = kwargs['key_type'] @@ -1903,6 +2354,8 @@ def __init__( self, **kwargs ): + """ + """ super(RequiredTraffic, self).__init__(**kwargs) self.protocol = None self.port = None @@ -1914,12 +2367,12 @@ def __init__( 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 + :ivar 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. - :type memory: str + :vartype cpu: str + :ivar 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. + :vartype memory: str """ _attribute_map = { @@ -1931,6 +2384,14 @@ def __init__( self, **kwargs ): + """ + :keyword 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. + :paramtype cpu: str + :keyword 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. + :paramtype memory: str + """ super(ResourceRequests, self).__init__(**kwargs) self.cpu = kwargs.get('cpu', None) self.memory = kwargs.get('memory', None) @@ -1939,23 +2400,23 @@ def __init__( class ResourceSku(msrest.serialization.Model): """Describes an available Azure Spring Cloud SKU. - :param resource_type: Gets the type of resource the SKU applies to. - :type resource_type: str - :param name: Gets the name of SKU. - :type name: str - :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 - :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 + :ivar resource_type: Gets the type of resource the SKU applies to. + :vartype resource_type: str + :ivar name: Gets the name of SKU. + :vartype name: str + :ivar tier: Gets the tier of SKU. + :vartype tier: str + :ivar capacity: Gets the capacity of SKU. + :vartype capacity: ~azure.mgmt.appplatform.v2021_06_01_preview.models.SkuCapacity + :ivar locations: Gets the set of locations that the SKU is available. + :vartype locations: list[str] + :ivar location_info: Gets a list of locations and availability zones in those locations where the SKU is available. - :type location_info: + :vartype 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 + :ivar restrictions: Gets the restrictions because of which SKU cannot be used. This is empty if there are no restrictions. - :type restrictions: + :vartype restrictions: list[~azure.mgmt.appplatform.v2021_06_01_preview.models.ResourceSkuRestrictions] """ @@ -1973,6 +2434,26 @@ def __init__( self, **kwargs ): + """ + :keyword resource_type: Gets the type of resource the SKU applies to. + :paramtype resource_type: str + :keyword name: Gets the name of SKU. + :paramtype name: str + :keyword tier: Gets the tier of SKU. + :paramtype tier: str + :keyword capacity: Gets the capacity of SKU. + :paramtype capacity: ~azure.mgmt.appplatform.v2021_06_01_preview.models.SkuCapacity + :keyword locations: Gets the set of locations that the SKU is available. + :paramtype locations: list[str] + :keyword location_info: Gets a list of locations and availability zones in those locations + where the SKU is available. + :paramtype location_info: + list[~azure.mgmt.appplatform.v2021_06_01_preview.models.ResourceSkuLocationInfo] + :keyword restrictions: Gets the restrictions because of which SKU cannot be used. This is + empty if there are no restrictions. + :paramtype restrictions: + list[~azure.mgmt.appplatform.v2021_06_01_preview.models.ResourceSkuRestrictions] + """ super(ResourceSku, self).__init__(**kwargs) self.resource_type = kwargs.get('resource_type', None) self.name = kwargs.get('name', None) @@ -1986,10 +2467,10 @@ def __init__( class ResourceSkuCapabilities(msrest.serialization.Model): """ResourceSkuCapabilities. - :param name: Gets an invariant to describe the feature. - :type name: str - :param value: Gets an invariant if the feature is measured by quantity. - :type value: str + :ivar name: Gets an invariant to describe the feature. + :vartype name: str + :ivar value: Gets an invariant if the feature is measured by quantity. + :vartype value: str """ _attribute_map = { @@ -2001,6 +2482,12 @@ def __init__( self, **kwargs ): + """ + :keyword name: Gets an invariant to describe the feature. + :paramtype name: str + :keyword value: Gets an invariant if the feature is measured by quantity. + :paramtype value: str + """ super(ResourceSkuCapabilities, self).__init__(**kwargs) self.name = kwargs.get('name', None) self.value = kwargs.get('value', None) @@ -2009,11 +2496,11 @@ def __init__( 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). + :ivar value: Collection of resource SKU. + :vartype value: list[~azure.mgmt.appplatform.v2021_06_01_preview.models.ResourceSku] + :ivar 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 + :vartype next_link: str """ _attribute_map = { @@ -2025,6 +2512,13 @@ def __init__( self, **kwargs ): + """ + :keyword value: Collection of resource SKU. + :paramtype value: list[~azure.mgmt.appplatform.v2021_06_01_preview.models.ResourceSku] + :keyword next_link: URL client should use to fetch the next page (per server side paging). + It's null for now, added for future use. + :paramtype next_link: str + """ super(ResourceSkuCollection, self).__init__(**kwargs) self.value = kwargs.get('value', None) self.next_link = kwargs.get('next_link', None) @@ -2033,12 +2527,12 @@ def __init__( class ResourceSkuLocationInfo(msrest.serialization.Model): """Locations and availability zones where the SKU is available. - :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: + :ivar location: Gets location of the SKU. + :vartype location: str + :ivar zones: Gets list of availability zones where the SKU is supported. + :vartype zones: list[str] + :ivar zone_details: Gets details of capabilities available to a SKU in specific zones. + :vartype zone_details: list[~azure.mgmt.appplatform.v2021_06_01_preview.models.ResourceSkuZoneDetails] """ @@ -2052,6 +2546,15 @@ def __init__( self, **kwargs ): + """ + :keyword location: Gets location of the SKU. + :paramtype location: str + :keyword zones: Gets list of availability zones where the SKU is supported. + :paramtype zones: list[str] + :keyword zone_details: Gets details of capabilities available to a SKU in specific zones. + :paramtype zone_details: + list[~azure.mgmt.appplatform.v2021_06_01_preview.models.ResourceSkuZoneDetails] + """ super(ResourceSkuLocationInfo, self).__init__(**kwargs) self.location = kwargs.get('location', None) self.zones = kwargs.get('zones', None) @@ -2061,10 +2564,10 @@ def __init__( class ResourceSkuRestrictionInfo(msrest.serialization.Model): """Information about the restriction where the SKU cannot be used. - :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] + :ivar locations: Gets locations where the SKU is restricted. + :vartype locations: list[str] + :ivar zones: Gets list of availability zones where the SKU is restricted. + :vartype zones: list[str] """ _attribute_map = { @@ -2076,6 +2579,12 @@ def __init__( self, **kwargs ): + """ + :keyword locations: Gets locations where the SKU is restricted. + :paramtype locations: list[str] + :keyword zones: Gets list of availability zones where the SKU is restricted. + :paramtype zones: list[str] + """ super(ResourceSkuRestrictionInfo, self).__init__(**kwargs) self.locations = kwargs.get('locations', None) self.zones = kwargs.get('zones', None) @@ -2084,21 +2593,21 @@ def __init__( class ResourceSkuRestrictions(msrest.serialization.Model): """Restrictions where the SKU cannot be used. - :param type: Gets the type of restrictions. Possible values include: 'Location', 'Zone'. + :ivar type: Gets the type of restrictions. Possible values include: 'Location', 'Zone'. Possible values include: "Location", "Zone". - :type type: str or + :vartype 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 + :ivar 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 + :vartype values: list[str] + :ivar restriction_info: Gets the information about the restriction where the SKU cannot be used. - :type restriction_info: + :vartype restriction_info: ~azure.mgmt.appplatform.v2021_06_01_preview.models.ResourceSkuRestrictionInfo - :param reason_code: Gets the reason for restriction. Possible values include: 'QuotaId', + :ivar reason_code: Gets the reason for restriction. Possible values include: 'QuotaId', 'NotAvailableForSubscription'. Possible values include: "QuotaId", "NotAvailableForSubscription". - :type reason_code: str or + :vartype reason_code: str or ~azure.mgmt.appplatform.v2021_06_01_preview.models.ResourceSkuRestrictionsReasonCode """ @@ -2113,6 +2622,24 @@ def __init__( self, **kwargs ): + """ + :keyword type: Gets the type of restrictions. Possible values include: 'Location', 'Zone'. + Possible values include: "Location", "Zone". + :paramtype type: str or + ~azure.mgmt.appplatform.v2021_06_01_preview.models.ResourceSkuRestrictionsType + :keyword values: Gets the value of restrictions. If the restriction type is set to + location. This would be different locations where the SKU is restricted. + :paramtype values: list[str] + :keyword restriction_info: Gets the information about the restriction where the SKU cannot be + used. + :paramtype restriction_info: + ~azure.mgmt.appplatform.v2021_06_01_preview.models.ResourceSkuRestrictionInfo + :keyword reason_code: Gets the reason for restriction. Possible values include: 'QuotaId', + 'NotAvailableForSubscription'. Possible values include: "QuotaId", + "NotAvailableForSubscription". + :paramtype reason_code: str or + ~azure.mgmt.appplatform.v2021_06_01_preview.models.ResourceSkuRestrictionsReasonCode + """ super(ResourceSkuRestrictions, self).__init__(**kwargs) self.type = kwargs.get('type', None) self.values = kwargs.get('values', None) @@ -2123,12 +2650,12 @@ def __init__( 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 + :ivar 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 + :vartype name: list[str] + :ivar capabilities: Gets a list of capabilities that are available for the SKU in the specified list of zones. - :type capabilities: + :vartype capabilities: list[~azure.mgmt.appplatform.v2021_06_01_preview.models.ResourceSkuCapabilities] """ @@ -2141,6 +2668,15 @@ def __init__( self, **kwargs ): + """ + :keyword name: Gets the set of zones that the SKU is available in with the + specified capabilities. + :paramtype name: list[str] + :keyword capabilities: Gets a list of capabilities that are available for the SKU in the + specified list of zones. + :paramtype capabilities: + list[~azure.mgmt.appplatform.v2021_06_01_preview.models.ResourceSkuCapabilities] + """ super(ResourceSkuZoneDetails, self).__init__(**kwargs) self.name = kwargs.get('name', None) self.capabilities = kwargs.get('capabilities', None) @@ -2149,10 +2685,10 @@ def __init__( class ResourceUploadDefinition(msrest.serialization.Model): """Resource upload definition payload. - :param relative_path: Source relative path. - :type relative_path: str - :param upload_url: Upload URL. - :type upload_url: str + :ivar relative_path: Source relative path. + :vartype relative_path: str + :ivar upload_url: Upload URL. + :vartype upload_url: str """ _attribute_map = { @@ -2164,6 +2700,12 @@ def __init__( self, **kwargs ): + """ + :keyword relative_path: Source relative path. + :paramtype relative_path: str + :keyword upload_url: Upload URL. + :paramtype upload_url: str + """ super(ResourceUploadDefinition, self).__init__(**kwargs) self.relative_path = kwargs.get('relative_path', None) self.upload_url = kwargs.get('upload_url', None) @@ -2180,11 +2722,11 @@ class TrackedResource(Resource): :vartype name: str :ivar type: The type of the resource. :vartype type: str - :param location: The GEO location of the resource. - :type location: str - :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] + :ivar location: The GEO location of the resource. + :vartype location: str + :ivar tags: A set of tags. Tags of the service which is a list of key value pairs that describe + the resource. + :vartype tags: dict[str, str] """ _validation = { @@ -2205,6 +2747,13 @@ def __init__( self, **kwargs ): + """ + :keyword location: The GEO location of the resource. + :paramtype location: str + :keyword tags: A set of tags. Tags of the service which is a list of key value pairs that + describe the resource. + :paramtype tags: dict[str, str] + """ super(TrackedResource, self).__init__(**kwargs) self.location = kwargs.get('location', None) self.tags = kwargs.get('tags', None) @@ -2221,15 +2770,16 @@ class ServiceResource(TrackedResource): :vartype name: str :ivar type: The type of the resource. :vartype type: str - :param location: The GEO location of the resource. - :type location: str - :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. - :type sku: ~azure.mgmt.appplatform.v2021_06_01_preview.models.Sku + :ivar location: The GEO location of the resource. + :vartype location: str + :ivar tags: A set of tags. Tags of the service which is a list of key value pairs that describe + the resource. + :vartype tags: dict[str, str] + :ivar properties: Properties of the Service resource. + :vartype properties: + ~azure.mgmt.appplatform.v2021_06_01_preview.models.ClusterResourceProperties + :ivar sku: Sku of the Service resource. + :vartype sku: ~azure.mgmt.appplatform.v2021_06_01_preview.models.Sku """ _validation = { @@ -2252,6 +2802,18 @@ def __init__( self, **kwargs ): + """ + :keyword location: The GEO location of the resource. + :paramtype location: str + :keyword tags: A set of tags. Tags of the service which is a list of key value pairs that + describe the resource. + :paramtype tags: dict[str, str] + :keyword properties: Properties of the Service resource. + :paramtype properties: + ~azure.mgmt.appplatform.v2021_06_01_preview.models.ClusterResourceProperties + :keyword sku: Sku of the Service resource. + :paramtype sku: ~azure.mgmt.appplatform.v2021_06_01_preview.models.Sku + """ super(ServiceResource, self).__init__(**kwargs) self.properties = kwargs.get('properties', None) self.sku = kwargs.get('sku', None) @@ -2260,11 +2822,11 @@ def __init__( 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). + :ivar value: Collection of Service resources. + :vartype value: list[~azure.mgmt.appplatform.v2021_06_01_preview.models.ServiceResource] + :ivar 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 + :vartype next_link: str """ _attribute_map = { @@ -2276,6 +2838,13 @@ def __init__( self, **kwargs ): + """ + :keyword value: Collection of Service resources. + :paramtype value: list[~azure.mgmt.appplatform.v2021_06_01_preview.models.ServiceResource] + :keyword next_link: URL client should use to fetch the next page (per server side paging). + It's null for now, added for future use. + :paramtype next_link: str + """ super(ServiceResourceList, self).__init__(**kwargs) self.value = kwargs.get('value', None) self.next_link = kwargs.get('next_link', None) @@ -2284,11 +2853,11 @@ def __init__( class ServiceSpecification(msrest.serialization.Model): """Service specification payload. - :param log_specifications: Specifications of the Log for Azure Monitoring. - :type log_specifications: + :ivar log_specifications: Specifications of the Log for Azure Monitoring. + :vartype log_specifications: list[~azure.mgmt.appplatform.v2021_06_01_preview.models.LogSpecification] - :param metric_specifications: Specifications of the Metrics for Azure Monitoring. - :type metric_specifications: + :ivar metric_specifications: Specifications of the Metrics for Azure Monitoring. + :vartype metric_specifications: list[~azure.mgmt.appplatform.v2021_06_01_preview.models.MetricSpecification] """ @@ -2301,6 +2870,14 @@ def __init__( self, **kwargs ): + """ + :keyword log_specifications: Specifications of the Log for Azure Monitoring. + :paramtype log_specifications: + list[~azure.mgmt.appplatform.v2021_06_01_preview.models.LogSpecification] + :keyword metric_specifications: Specifications of the Metrics for Azure Monitoring. + :paramtype metric_specifications: + list[~azure.mgmt.appplatform.v2021_06_01_preview.models.MetricSpecification] + """ super(ServiceSpecification, self).__init__(**kwargs) self.log_specifications = kwargs.get('log_specifications', None) self.metric_specifications = kwargs.get('metric_specifications', None) @@ -2309,12 +2886,12 @@ def __init__( class Sku(msrest.serialization.Model): """Sku of Azure Spring Cloud. - :param name: Name of the Sku. - :type name: str - :param tier: Tier of the Sku. - :type tier: str - :param capacity: Current capacity of the target resource. - :type capacity: int + :ivar name: Name of the Sku. + :vartype name: str + :ivar tier: Tier of the Sku. + :vartype tier: str + :ivar capacity: Current capacity of the target resource. + :vartype capacity: int """ _attribute_map = { @@ -2327,6 +2904,14 @@ def __init__( self, **kwargs ): + """ + :keyword name: Name of the Sku. + :paramtype name: str + :keyword tier: Tier of the Sku. + :paramtype tier: str + :keyword capacity: Current capacity of the target resource. + :paramtype capacity: int + """ super(Sku, self).__init__(**kwargs) self.name = kwargs.get('name', "S0") self.tier = kwargs.get('tier', "Standard") @@ -2338,15 +2923,15 @@ class SkuCapacity(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param minimum: Required. Gets or sets the minimum. - :type minimum: int - :param maximum: Gets or sets the maximum. - :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", + :ivar minimum: Required. Gets or sets the minimum. + :vartype minimum: int + :ivar maximum: Gets or sets the maximum. + :vartype maximum: int + :ivar default: Gets or sets the default. + :vartype default: int + :ivar 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 + :vartype scale_type: str or ~azure.mgmt.appplatform.v2021_06_01_preview.models.SkuScaleType """ _validation = { @@ -2364,6 +2949,17 @@ def __init__( self, **kwargs ): + """ + :keyword minimum: Required. Gets or sets the minimum. + :paramtype minimum: int + :keyword maximum: Gets or sets the maximum. + :paramtype maximum: int + :keyword default: Gets or sets the default. + :paramtype default: int + :keyword scale_type: Gets or sets the type of the scale. Possible values include: "None", + "Manual", "Automatic". + :paramtype scale_type: str or ~azure.mgmt.appplatform.v2021_06_01_preview.models.SkuScaleType + """ super(SkuCapacity, self).__init__(**kwargs) self.minimum = kwargs['minimum'] self.maximum = kwargs.get('maximum', None) @@ -2374,15 +2970,15 @@ def __init__( 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"). + :ivar value: The raw value which could be passed to deployment CRUD operations. Possible values + include: "Java_8", "Java_11", "NetCore_31". + :vartype value: str or ~azure.mgmt.appplatform.v2021_06_01_preview.models.SupportedRuntimeValue + :ivar platform: The platform of this runtime version (possible values: "Java" or ".NET"). Possible values include: "Java", ".NET Core". - :type platform: str or + :vartype platform: str or ~azure.mgmt.appplatform.v2021_06_01_preview.models.SupportedRuntimePlatform - :param version: The detailed version (major.minor) of the platform. - :type version: str + :ivar version: The detailed version (major.minor) of the platform. + :vartype version: str """ _attribute_map = { @@ -2395,6 +2991,18 @@ def __init__( self, **kwargs ): + """ + :keyword value: The raw value which could be passed to deployment CRUD operations. Possible + values include: "Java_8", "Java_11", "NetCore_31". + :paramtype value: str or + ~azure.mgmt.appplatform.v2021_06_01_preview.models.SupportedRuntimeValue + :keyword platform: The platform of this runtime version (possible values: "Java" or ".NET"). + Possible values include: "Java", ".NET Core". + :paramtype platform: str or + ~azure.mgmt.appplatform.v2021_06_01_preview.models.SupportedRuntimePlatform + :keyword version: The detailed version (major.minor) of the platform. + :paramtype version: str + """ super(SupportedRuntimeVersion, self).__init__(**kwargs) self.value = kwargs.get('value', None) self.platform = kwargs.get('platform', None) @@ -2404,10 +3012,10 @@ def __init__( class TemporaryDisk(msrest.serialization.Model): """Temporary disk payload. - :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. - :type mount_path: str + :ivar size_in_gb: Size of the temporary disk in GB. + :vartype size_in_gb: int + :ivar mount_path: Mount path of the temporary disk. + :vartype mount_path: str """ _validation = { @@ -2423,24 +3031,30 @@ def __init__( self, **kwargs ): + """ + :keyword size_in_gb: Size of the temporary disk in GB. + :paramtype size_in_gb: int + :keyword mount_path: Mount path of the temporary disk. + :paramtype mount_path: str + """ 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(msrest.serialization.Model): """Test keys payload. - :param primary_key: Primary key. - :type primary_key: str - :param secondary_key: Secondary key. - :type secondary_key: str - :param primary_test_endpoint: Primary test endpoint. - :type primary_test_endpoint: str - :param secondary_test_endpoint: Secondary test endpoint. - :type secondary_test_endpoint: str - :param enabled: Indicates whether the test endpoint feature enabled or not. - :type enabled: bool + :ivar primary_key: Primary key. + :vartype primary_key: str + :ivar secondary_key: Secondary key. + :vartype secondary_key: str + :ivar primary_test_endpoint: Primary test endpoint. + :vartype primary_test_endpoint: str + :ivar secondary_test_endpoint: Secondary test endpoint. + :vartype secondary_test_endpoint: str + :ivar enabled: Indicates whether the test endpoint feature enabled or not. + :vartype enabled: bool """ _attribute_map = { @@ -2455,6 +3069,18 @@ def __init__( self, **kwargs ): + """ + :keyword primary_key: Primary key. + :paramtype primary_key: str + :keyword secondary_key: Secondary key. + :paramtype secondary_key: str + :keyword primary_test_endpoint: Primary test endpoint. + :paramtype primary_test_endpoint: str + :keyword secondary_test_endpoint: Secondary test endpoint. + :paramtype secondary_test_endpoint: str + :keyword enabled: Indicates whether the test endpoint feature enabled or not. + :paramtype enabled: bool + """ super(TestKeys, self).__init__(**kwargs) self.primary_key = kwargs.get('primary_key', None) self.secondary_key = kwargs.get('secondary_key', None) @@ -2466,19 +3092,19 @@ def __init__( class UserSourceInfo(msrest.serialization.Model): """Source information for a deployment. - :param type: Type of the source uploaded. Possible values include: "Jar", "NetCoreZip", + :ivar 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. - :type version: str - :param artifact_selector: Selector for the artifact to be used for the deployment for + :vartype type: str or ~azure.mgmt.appplatform.v2021_06_01_preview.models.UserSourceType + :ivar relative_path: Relative path of the storage which stores the source. + :vartype relative_path: str + :ivar version: Version of the source. + :vartype version: str + :ivar 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 + :vartype artifact_selector: str + :ivar custom_container: Custom container payload. + :vartype custom_container: ~azure.mgmt.appplatform.v2021_06_01_preview.models.CustomContainer """ _attribute_map = { @@ -2493,6 +3119,21 @@ def __init__( self, **kwargs ): + """ + :keyword type: Type of the source uploaded. Possible values include: "Jar", "NetCoreZip", + "Source", "Container". + :paramtype type: str or ~azure.mgmt.appplatform.v2021_06_01_preview.models.UserSourceType + :keyword relative_path: Relative path of the storage which stores the source. + :paramtype relative_path: str + :keyword version: Version of the source. + :paramtype version: str + :keyword 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. + :paramtype artifact_selector: str + :keyword custom_container: Custom container payload. + :paramtype custom_container: ~azure.mgmt.appplatform.v2021_06_01_preview.models.CustomContainer + """ super(UserSourceInfo, self).__init__(**kwargs) self.type = kwargs.get('type', None) self.relative_path = kwargs.get('relative_path', None) diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2021_06_01_preview/models/_models_py3.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2021_06_01_preview/models/_models_py3.py index f2bb0bee5df19..1cd1bb6ef9ec7 100644 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2021_06_01_preview/models/_models_py3.py +++ b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2021_06_01_preview/models/_models_py3.py @@ -34,6 +34,8 @@ def __init__( self, **kwargs ): + """ + """ super(ApplicationInsightsAgentVersions, self).__init__(**kwargs) self.java = None @@ -67,6 +69,8 @@ def __init__( self, **kwargs ): + """ + """ super(Resource, self).__init__(**kwargs) self.id = None self.name = None @@ -102,6 +106,8 @@ def __init__( self, **kwargs ): + """ + """ super(ProxyResource, self).__init__(**kwargs) @@ -116,12 +122,12 @@ 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. - :type location: str + :ivar properties: Properties of the App resource. + :vartype properties: ~azure.mgmt.appplatform.v2021_06_01_preview.models.AppResourceProperties + :ivar identity: The Managed Identity type of the app resource. + :vartype identity: ~azure.mgmt.appplatform.v2021_06_01_preview.models.ManagedIdentityProperties + :ivar location: The GEO location of the application, always the same with its parent resource. + :vartype location: str """ _validation = { @@ -147,6 +153,16 @@ def __init__( location: Optional[str] = None, **kwargs ): + """ + :keyword properties: Properties of the App resource. + :paramtype properties: ~azure.mgmt.appplatform.v2021_06_01_preview.models.AppResourceProperties + :keyword identity: The Managed Identity type of the app resource. + :paramtype identity: + ~azure.mgmt.appplatform.v2021_06_01_preview.models.ManagedIdentityProperties + :keyword location: The GEO location of the application, always the same with its parent + resource. + :paramtype location: str + """ super(AppResource, self).__init__(**kwargs) self.properties = properties self.identity = identity @@ -156,11 +172,11 @@ def __init__( 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). + :ivar value: Collection of App resources. + :vartype value: list[~azure.mgmt.appplatform.v2021_06_01_preview.models.AppResource] + :ivar 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 + :vartype next_link: str """ _attribute_map = { @@ -175,6 +191,13 @@ def __init__( next_link: Optional[str] = None, **kwargs ): + """ + :keyword value: Collection of App resources. + :paramtype value: list[~azure.mgmt.appplatform.v2021_06_01_preview.models.AppResource] + :keyword next_link: URL client should use to fetch the next page (per server side paging). + It's null for now, added for future use. + :paramtype next_link: str + """ super(AppResourceCollection, self).__init__(**kwargs) self.value = value self.next_link = next_link @@ -185,28 +208,28 @@ class AppResourceProperties(msrest.serialization.Model): Variables are only populated by the server, and will be ignored when sending a request. - :param public: Indicates whether the App exposes public endpoint. - :type public: bool + :ivar public: Indicates whether the App exposes public endpoint. + :vartype public: bool :ivar url: URL of the App. :vartype url: str :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. - :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 active_deployment_name: Name of the active deployment of the App. + :vartype active_deployment_name: str + :ivar fqdn: Fully qualified dns Name. + :vartype fqdn: str + :ivar https_only: Indicate if only https is allowed. + :vartype https_only: bool :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 + :ivar temporary_disk: Temporary disk settings. + :vartype temporary_disk: ~azure.mgmt.appplatform.v2021_06_01_preview.models.TemporaryDisk + :ivar persistent_disk: Persistent disk settings. + :vartype persistent_disk: ~azure.mgmt.appplatform.v2021_06_01_preview.models.PersistentDisk + :ivar enable_end_to_end_tls: Indicate if end to end TLS is enabled. + :vartype enable_end_to_end_tls: bool """ _validation = { @@ -234,12 +257,28 @@ def __init__( public: Optional[bool] = None, active_deployment_name: Optional[str] = None, fqdn: Optional[str] = None, - https_only: Optional[bool] = None, + https_only: Optional[bool] = False, temporary_disk: Optional["TemporaryDisk"] = None, persistent_disk: Optional["PersistentDisk"] = None, - enable_end_to_end_tls: Optional[bool] = None, - **kwargs - ): + enable_end_to_end_tls: Optional[bool] = False, + **kwargs + ): + """ + :keyword public: Indicates whether the App exposes public endpoint. + :paramtype public: bool + :keyword active_deployment_name: Name of the active deployment of the App. + :paramtype active_deployment_name: str + :keyword fqdn: Fully qualified dns Name. + :paramtype fqdn: str + :keyword https_only: Indicate if only https is allowed. + :paramtype https_only: bool + :keyword temporary_disk: Temporary disk settings. + :paramtype temporary_disk: ~azure.mgmt.appplatform.v2021_06_01_preview.models.TemporaryDisk + :keyword persistent_disk: Persistent disk settings. + :paramtype persistent_disk: ~azure.mgmt.appplatform.v2021_06_01_preview.models.PersistentDisk + :keyword enable_end_to_end_tls: Indicate if end to end TLS is enabled. + :paramtype enable_end_to_end_tls: bool + """ super(AppResourceProperties, self).__init__(**kwargs) self.public = public self.url = None @@ -256,11 +295,11 @@ def __init__( 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). + :ivar value: Collection of available operation details. + :vartype value: list[~azure.mgmt.appplatform.v2021_06_01_preview.models.OperationDetail] + :ivar 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 + :vartype next_link: str """ _attribute_map = { @@ -275,6 +314,13 @@ def __init__( next_link: Optional[str] = None, **kwargs ): + """ + :keyword value: Collection of available operation details. + :paramtype value: list[~azure.mgmt.appplatform.v2021_06_01_preview.models.OperationDetail] + :keyword next_link: URL client should use to fetch the next page (per server side paging). + It's null for now, added for future use. + :paramtype next_link: str + """ super(AvailableOperations, self).__init__(**kwargs) self.value = value self.next_link = next_link @@ -302,6 +348,8 @@ def __init__( self, **kwargs ): + """ + """ super(AvailableRuntimeVersions, self).__init__(**kwargs) self.value = None @@ -317,8 +365,9 @@ 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 + :ivar properties: Properties of the Binding resource. + :vartype properties: + ~azure.mgmt.appplatform.v2021_06_01_preview.models.BindingResourceProperties """ _validation = { @@ -340,6 +389,11 @@ def __init__( properties: Optional["BindingResourceProperties"] = None, **kwargs ): + """ + :keyword properties: Properties of the Binding resource. + :paramtype properties: + ~azure.mgmt.appplatform.v2021_06_01_preview.models.BindingResourceProperties + """ super(BindingResource, self).__init__(**kwargs) self.properties = properties @@ -347,11 +401,11 @@ def __init__( 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). + :ivar value: Collection of Binding resources. + :vartype value: list[~azure.mgmt.appplatform.v2021_06_01_preview.models.BindingResource] + :ivar 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 + :vartype next_link: str """ _attribute_map = { @@ -366,6 +420,13 @@ def __init__( next_link: Optional[str] = None, **kwargs ): + """ + :keyword value: Collection of Binding resources. + :paramtype value: list[~azure.mgmt.appplatform.v2021_06_01_preview.models.BindingResource] + :keyword next_link: URL client should use to fetch the next page (per server side paging). + It's null for now, added for future use. + :paramtype next_link: str + """ super(BindingResourceCollection, self).__init__(**kwargs) self.value = value self.next_link = next_link @@ -380,12 +441,12 @@ class BindingResourceProperties(msrest.serialization.Model): :vartype resource_name: str :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. - :type resource_id: str - :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, any] + :ivar resource_id: The Azure resource id of the bound resource. + :vartype resource_id: str + :ivar key: The key of the bound resource. + :vartype key: str + :ivar binding_parameters: Binding parameters of the Binding resource. + :vartype 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 @@ -422,6 +483,14 @@ def __init__( binding_parameters: Optional[Dict[str, Any]] = None, **kwargs ): + """ + :keyword resource_id: The Azure resource id of the bound resource. + :paramtype resource_id: str + :keyword key: The key of the bound resource. + :paramtype key: str + :keyword binding_parameters: Binding parameters of the Binding resource. + :paramtype binding_parameters: dict[str, any] + """ super(BindingResourceProperties, self).__init__(**kwargs) self.resource_name = None self.resource_type = None @@ -442,12 +511,12 @@ class CertificateProperties(msrest.serialization.Model): :ivar thumbprint: The thumbprint of certificate. :vartype thumbprint: str - :param vault_uri: Required. The vault uri of user key vault. - :type vault_uri: str - :param key_vault_cert_name: Required. The certificate name of key vault. - :type key_vault_cert_name: str - :param cert_version: The certificate version of key vault. - :type cert_version: str + :ivar vault_uri: Required. The vault uri of user key vault. + :vartype vault_uri: str + :ivar key_vault_cert_name: Required. The certificate name of key vault. + :vartype key_vault_cert_name: str + :ivar cert_version: The certificate version of key vault. + :vartype cert_version: str :ivar issuer: The issuer of certificate. :vartype issuer: str :ivar issued_date: The issue date of certificate. @@ -495,6 +564,14 @@ def __init__( cert_version: Optional[str] = None, **kwargs ): + """ + :keyword vault_uri: Required. The vault uri of user key vault. + :paramtype vault_uri: str + :keyword key_vault_cert_name: Required. The certificate name of key vault. + :paramtype key_vault_cert_name: str + :keyword cert_version: The certificate version of key vault. + :paramtype cert_version: str + """ super(CertificateProperties, self).__init__(**kwargs) self.thumbprint = None self.vault_uri = vault_uri @@ -519,8 +596,8 @@ class CertificateResource(ProxyResource): :vartype name: str :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 + :ivar properties: Properties of the certificate resource payload. + :vartype properties: ~azure.mgmt.appplatform.v2021_06_01_preview.models.CertificateProperties """ _validation = { @@ -542,6 +619,10 @@ def __init__( properties: Optional["CertificateProperties"] = None, **kwargs ): + """ + :keyword properties: Properties of the certificate resource payload. + :paramtype properties: ~azure.mgmt.appplatform.v2021_06_01_preview.models.CertificateProperties + """ super(CertificateResource, self).__init__(**kwargs) self.properties = properties @@ -549,10 +630,10 @@ def __init__( class CertificateResourceCollection(msrest.serialization.Model): """Collection compose of certificate resources list and a possible link for next page. - :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 + :ivar value: The certificate resources list. + :vartype value: list[~azure.mgmt.appplatform.v2021_06_01_preview.models.CertificateResource] + :ivar next_link: The link to next page of certificate list. + :vartype next_link: str """ _attribute_map = { @@ -567,6 +648,12 @@ def __init__( next_link: Optional[str] = None, **kwargs ): + """ + :keyword value: The certificate resources list. + :paramtype value: list[~azure.mgmt.appplatform.v2021_06_01_preview.models.CertificateResource] + :keyword next_link: The link to next page of certificate list. + :paramtype next_link: str + """ super(CertificateResourceCollection, self).__init__(**kwargs) self.value = value self.next_link = next_link @@ -575,17 +662,17 @@ def __init__( 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 + :ivar 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 + :vartype code: str + :ivar 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 + :vartype message: str + :ivar 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] + :vartype target: str + :ivar details: A list of additional details about the error. + :vartype details: list[~azure.mgmt.appplatform.v2021_06_01_preview.models.CloudErrorBody] """ _attribute_map = { @@ -604,6 +691,19 @@ def __init__( details: Optional[List["CloudErrorBody"]] = None, **kwargs ): + """ + :keyword code: An identifier for the error. Codes are invariant and are intended to be consumed + programmatically. + :paramtype code: str + :keyword message: A message describing the error, intended to be suitable for display in a user + interface. + :paramtype message: str + :keyword target: The target of the particular error. For example, the name of the property in + error. + :paramtype target: str + :keyword details: A list of additional details about the error. + :paramtype details: list[~azure.mgmt.appplatform.v2021_06_01_preview.models.CloudErrorBody] + """ super(CloudErrorBody, self).__init__(**kwargs) self.code = code self.message = message @@ -621,8 +721,8 @@ class ClusterResourceProperties(msrest.serialization.Model): "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 network_profile: Network profile of the Service. + :vartype 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. @@ -648,6 +748,10 @@ def __init__( network_profile: Optional["NetworkProfile"] = None, **kwargs ): + """ + :keyword network_profile: Network profile of the Service. + :paramtype network_profile: ~azure.mgmt.appplatform.v2021_06_01_preview.models.NetworkProfile + """ super(ClusterResourceProperties, self).__init__(**kwargs) self.provisioning_state = None self.network_profile = network_profile @@ -660,27 +764,27 @@ class ConfigServerGitProperty(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param repositories: Repositories of git. - :type repositories: + :ivar repositories: Repositories of git. + :vartype repositories: list[~azure.mgmt.appplatform.v2021_06_01_preview.models.GitPatternRepository] - :param uri: Required. URI of the repository. - :type uri: str - :param label: Label of the repository. - :type label: str - :param search_paths: Searching path of the repository. - :type search_paths: list[str] - :param username: Username of git repository basic auth. - :type username: str - :param password: Password of git repository basic auth. - :type password: str - :param host_key: Public sshKey of git repository. - :type host_key: str - :param host_key_algorithm: SshKey algorithm of git repository. - :type host_key_algorithm: str - :param private_key: Private sshKey algorithm of git repository. - :type private_key: str - :param strict_host_key_checking: Strict host key checking or not. - :type strict_host_key_checking: bool + :ivar uri: Required. URI of the repository. + :vartype uri: str + :ivar label: Label of the repository. + :vartype label: str + :ivar search_paths: Searching path of the repository. + :vartype search_paths: list[str] + :ivar username: Username of git repository basic auth. + :vartype username: str + :ivar password: Password of git repository basic auth. + :vartype password: str + :ivar host_key: Public sshKey of git repository. + :vartype host_key: str + :ivar host_key_algorithm: SshKey algorithm of git repository. + :vartype host_key_algorithm: str + :ivar private_key: Private sshKey algorithm of git repository. + :vartype private_key: str + :ivar strict_host_key_checking: Strict host key checking or not. + :vartype strict_host_key_checking: bool """ _validation = { @@ -715,6 +819,29 @@ def __init__( strict_host_key_checking: Optional[bool] = None, **kwargs ): + """ + :keyword repositories: Repositories of git. + :paramtype repositories: + list[~azure.mgmt.appplatform.v2021_06_01_preview.models.GitPatternRepository] + :keyword uri: Required. URI of the repository. + :paramtype uri: str + :keyword label: Label of the repository. + :paramtype label: str + :keyword search_paths: Searching path of the repository. + :paramtype search_paths: list[str] + :keyword username: Username of git repository basic auth. + :paramtype username: str + :keyword password: Password of git repository basic auth. + :paramtype password: str + :keyword host_key: Public sshKey of git repository. + :paramtype host_key: str + :keyword host_key_algorithm: SshKey algorithm of git repository. + :paramtype host_key_algorithm: str + :keyword private_key: Private sshKey algorithm of git repository. + :paramtype private_key: str + :keyword strict_host_key_checking: Strict host key checking or not. + :paramtype strict_host_key_checking: bool + """ super(ConfigServerGitProperty, self).__init__(**kwargs) self.repositories = repositories self.uri = uri @@ -737,10 +864,10 @@ class ConfigServerProperties(msrest.serialization.Model): "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 + :ivar error: Error when apply config server settings. + :vartype error: ~azure.mgmt.appplatform.v2021_06_01_preview.models.Error + :ivar config_server: Settings of config server. + :vartype config_server: ~azure.mgmt.appplatform.v2021_06_01_preview.models.ConfigServerSettings """ _validation = { @@ -760,6 +887,13 @@ def __init__( config_server: Optional["ConfigServerSettings"] = None, **kwargs ): + """ + :keyword error: Error when apply config server settings. + :paramtype error: ~azure.mgmt.appplatform.v2021_06_01_preview.models.Error + :keyword config_server: Settings of config server. + :paramtype config_server: + ~azure.mgmt.appplatform.v2021_06_01_preview.models.ConfigServerSettings + """ super(ConfigServerProperties, self).__init__(**kwargs) self.provisioning_state = None self.error = error @@ -777,8 +911,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 + :ivar properties: Properties of the Config Server resource. + :vartype properties: ~azure.mgmt.appplatform.v2021_06_01_preview.models.ConfigServerProperties """ _validation = { @@ -800,6 +934,11 @@ def __init__( properties: Optional["ConfigServerProperties"] = None, **kwargs ): + """ + :keyword properties: Properties of the Config Server resource. + :paramtype properties: + ~azure.mgmt.appplatform.v2021_06_01_preview.models.ConfigServerProperties + """ super(ConfigServerResource, self).__init__(**kwargs) self.properties = properties @@ -807,8 +946,9 @@ def __init__( 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 + :ivar git_property: Property of git environment. + :vartype git_property: + ~azure.mgmt.appplatform.v2021_06_01_preview.models.ConfigServerGitProperty """ _attribute_map = { @@ -821,6 +961,11 @@ def __init__( git_property: Optional["ConfigServerGitProperty"] = None, **kwargs ): + """ + :keyword git_property: Property of git environment. + :paramtype git_property: + ~azure.mgmt.appplatform.v2021_06_01_preview.models.ConfigServerGitProperty + """ super(ConfigServerSettings, self).__init__(**kwargs) self.git_property = git_property @@ -828,12 +973,12 @@ def __init__( class ConfigServerSettingsErrorRecord(msrest.serialization.Model): """Error record of the config server settings. - :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. - :type uri: str - :param messages: The detail error messages of the record. - :type messages: list[str] + :ivar name: The name of the config server settings error record. + :vartype name: str + :ivar uri: The uri of the config server settings error record. + :vartype uri: str + :ivar messages: The detail error messages of the record. + :vartype messages: list[str] """ _attribute_map = { @@ -850,6 +995,14 @@ def __init__( messages: Optional[List[str]] = None, **kwargs ): + """ + :keyword name: The name of the config server settings error record. + :paramtype name: str + :keyword uri: The uri of the config server settings error record. + :paramtype uri: str + :keyword messages: The detail error messages of the record. + :paramtype messages: list[str] + """ super(ConfigServerSettingsErrorRecord, self).__init__(**kwargs) self.name = name self.uri = uri @@ -859,10 +1012,10 @@ def __init__( class ConfigServerSettingsValidateResult(msrest.serialization.Model): """Validation result for config server settings. - :param is_valid: Indicate if the config server settings are valid. - :type is_valid: bool - :param details: The detail validation results. - :type details: + :ivar is_valid: Indicate if the config server settings are valid. + :vartype is_valid: bool + :ivar details: The detail validation results. + :vartype details: list[~azure.mgmt.appplatform.v2021_06_01_preview.models.ConfigServerSettingsErrorRecord] """ @@ -878,6 +1031,13 @@ def __init__( details: Optional[List["ConfigServerSettingsErrorRecord"]] = None, **kwargs ): + """ + :keyword is_valid: Indicate if the config server settings are valid. + :paramtype is_valid: bool + :keyword details: The detail validation results. + :paramtype details: + list[~azure.mgmt.appplatform.v2021_06_01_preview.models.ConfigServerSettingsErrorRecord] + """ super(ConfigServerSettingsValidateResult, self).__init__(**kwargs) self.is_valid = is_valid self.details = details @@ -886,19 +1046,19 @@ def __init__( 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 + :ivar server: The name of the registry that contains the container image. + :vartype server: str + :ivar 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 + :vartype container_image: str + :ivar 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 + :vartype command: list[str] + :ivar 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: + :vartype args: list[str] + :ivar image_registry_credential: Credential of the image registry. + :vartype image_registry_credential: ~azure.mgmt.appplatform.v2021_06_01_preview.models.ImageRegistryCredential """ @@ -920,6 +1080,22 @@ def __init__( image_registry_credential: Optional["ImageRegistryCredential"] = None, **kwargs ): + """ + :keyword server: The name of the registry that contains the container image. + :paramtype server: str + :keyword container_image: Container image of the custom container. This should be in the form + of :code:``::code:`` without the server name of the registry. + :paramtype container_image: str + :keyword command: Entrypoint array. Not executed within a shell. The docker image's ENTRYPOINT + is used if this is not provided. + :paramtype command: list[str] + :keyword args: Arguments to the entrypoint. The docker image's CMD is used if this is not + provided. + :paramtype args: list[str] + :keyword image_registry_credential: Credential of the image registry. + :paramtype image_registry_credential: + ~azure.mgmt.appplatform.v2021_06_01_preview.models.ImageRegistryCredential + """ super(CustomContainer, self).__init__(**kwargs) self.server = server self.container_image = container_image @@ -933,12 +1109,12 @@ class CustomDomainProperties(msrest.serialization.Model): 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 + :ivar thumbprint: The thumbprint of bound certificate. + :vartype thumbprint: str :ivar app_name: The app name of domain. :vartype app_name: str - :param cert_name: The bound certificate name of domain. - :type cert_name: str + :ivar cert_name: The bound certificate name of domain. + :vartype cert_name: str """ _validation = { @@ -958,6 +1134,12 @@ def __init__( cert_name: Optional[str] = None, **kwargs ): + """ + :keyword thumbprint: The thumbprint of bound certificate. + :paramtype thumbprint: str + :keyword cert_name: The bound certificate name of domain. + :paramtype cert_name: str + """ super(CustomDomainProperties, self).__init__(**kwargs) self.thumbprint = thumbprint self.app_name = None @@ -975,8 +1157,8 @@ class CustomDomainResource(ProxyResource): :vartype name: str :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 + :ivar properties: Properties of the custom domain resource. + :vartype properties: ~azure.mgmt.appplatform.v2021_06_01_preview.models.CustomDomainProperties """ _validation = { @@ -998,6 +1180,11 @@ def __init__( properties: Optional["CustomDomainProperties"] = None, **kwargs ): + """ + :keyword properties: Properties of the custom domain resource. + :paramtype properties: + ~azure.mgmt.appplatform.v2021_06_01_preview.models.CustomDomainProperties + """ super(CustomDomainResource, self).__init__(**kwargs) self.properties = properties @@ -1005,10 +1192,10 @@ def __init__( 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 + :ivar value: The custom domain resources list. + :vartype value: list[~azure.mgmt.appplatform.v2021_06_01_preview.models.CustomDomainResource] + :ivar next_link: The link to next page of custom domain list. + :vartype next_link: str """ _attribute_map = { @@ -1023,6 +1210,12 @@ def __init__( next_link: Optional[str] = None, **kwargs ): + """ + :keyword value: The custom domain resources list. + :paramtype value: list[~azure.mgmt.appplatform.v2021_06_01_preview.models.CustomDomainResource] + :keyword next_link: The link to next page of custom domain list. + :paramtype next_link: str + """ super(CustomDomainResourceCollection, self).__init__(**kwargs) self.value = value self.next_link = next_link @@ -1033,8 +1226,8 @@ class CustomDomainValidatePayload(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param name: Required. Name to be validated. - :type name: str + :ivar name: Required. Name to be validated. + :vartype name: str """ _validation = { @@ -1051,6 +1244,10 @@ def __init__( name: str, **kwargs ): + """ + :keyword name: Required. Name to be validated. + :paramtype name: str + """ super(CustomDomainValidatePayload, self).__init__(**kwargs) self.name = name @@ -1058,10 +1255,10 @@ def __init__( class CustomDomainValidateResult(msrest.serialization.Model): """Validation result for custom domain. - :param is_valid: Indicates if domain name is valid. - :type is_valid: bool - :param message: Message of why domain name is invalid. - :type message: str + :ivar is_valid: Indicates if domain name is valid. + :vartype is_valid: bool + :ivar message: Message of why domain name is invalid. + :vartype message: str """ _attribute_map = { @@ -1076,6 +1273,12 @@ def __init__( message: Optional[str] = None, **kwargs ): + """ + :keyword is_valid: Indicates if domain name is valid. + :paramtype is_valid: bool + :keyword message: Message of why domain name is invalid. + :paramtype message: str + """ super(CustomDomainValidateResult, self).__init__(**kwargs) self.is_valid = is_valid self.message = message @@ -1118,6 +1321,8 @@ def __init__( self, **kwargs ): + """ + """ super(DeploymentInstance, self).__init__(**kwargs) self.name = None self.status = None @@ -1137,11 +1342,11 @@ 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: + :ivar properties: Properties of the Deployment resource. + :vartype 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 + :ivar sku: Sku of the Deployment resource. + :vartype sku: ~azure.mgmt.appplatform.v2021_06_01_preview.models.Sku """ _validation = { @@ -1165,6 +1370,13 @@ def __init__( sku: Optional["Sku"] = None, **kwargs ): + """ + :keyword properties: Properties of the Deployment resource. + :paramtype properties: + ~azure.mgmt.appplatform.v2021_06_01_preview.models.DeploymentResourceProperties + :keyword sku: Sku of the Deployment resource. + :paramtype sku: ~azure.mgmt.appplatform.v2021_06_01_preview.models.Sku + """ super(DeploymentResource, self).__init__(**kwargs) self.properties = properties self.sku = sku @@ -1173,11 +1385,11 @@ def __init__( 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). + :ivar value: Collection of Deployment resources. + :vartype value: list[~azure.mgmt.appplatform.v2021_06_01_preview.models.DeploymentResource] + :ivar 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 + :vartype next_link: str """ _attribute_map = { @@ -1192,6 +1404,13 @@ def __init__( next_link: Optional[str] = None, **kwargs ): + """ + :keyword value: Collection of Deployment resources. + :paramtype value: list[~azure.mgmt.appplatform.v2021_06_01_preview.models.DeploymentResource] + :keyword next_link: URL client should use to fetch the next page (per server side paging). + It's null for now, added for future use. + :paramtype next_link: str + """ super(DeploymentResourceCollection, self).__init__(**kwargs) self.value = value self.next_link = next_link @@ -1202,12 +1421,12 @@ class DeploymentResourceProperties(msrest.serialization.Model): 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 source: Uploaded source information of the deployment. + :vartype 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. - :type deployment_settings: + :ivar deployment_settings: Deployment settings of the Deployment. + :vartype 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". @@ -1252,6 +1471,13 @@ def __init__( deployment_settings: Optional["DeploymentSettings"] = None, **kwargs ): + """ + :keyword source: Uploaded source information of the deployment. + :paramtype source: ~azure.mgmt.appplatform.v2021_06_01_preview.models.UserSourceInfo + :keyword deployment_settings: Deployment settings of the Deployment. + :paramtype deployment_settings: + ~azure.mgmt.appplatform.v2021_06_01_preview.models.DeploymentSettings + """ super(DeploymentResourceProperties, self).__init__(**kwargs) self.source = source self.app_name = None @@ -1266,27 +1492,28 @@ def __init__( 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 + :ivar 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, + :vartype cpu: int + :ivar 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 + :vartype memory_in_gb: int + :ivar 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. - :type net_core_main_entry_path: str - :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 + :vartype resource_requests: ~azure.mgmt.appplatform.v2021_06_01_preview.models.ResourceRequests + :ivar jvm_options: JVM parameter. + :vartype jvm_options: str + :ivar net_core_main_entry_path: The path to the .NET executable relative to zip root. + :vartype net_core_main_entry_path: str + :ivar environment_variables: Collection of environment variables. + :vartype environment_variables: dict[str, str] + :ivar runtime_version: Runtime version. Possible values include: "Java_8", "Java_11", + "NetCore_31". Default value: "Java_8". + :vartype runtime_version: str or + ~azure.mgmt.appplatform.v2021_06_01_preview.models.RuntimeVersion """ _attribute_map = { @@ -1308,9 +1535,34 @@ def __init__( 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 - ): + runtime_version: Optional[Union[str, "RuntimeVersion"]] = "Java_8", + **kwargs + ): + """ + :keyword 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. + :paramtype cpu: int + :keyword 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. + :paramtype memory_in_gb: int + :keyword 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. + :paramtype resource_requests: + ~azure.mgmt.appplatform.v2021_06_01_preview.models.ResourceRequests + :keyword jvm_options: JVM parameter. + :paramtype jvm_options: str + :keyword net_core_main_entry_path: The path to the .NET executable relative to zip root. + :paramtype net_core_main_entry_path: str + :keyword environment_variables: Collection of environment variables. + :paramtype environment_variables: dict[str, str] + :keyword runtime_version: Runtime version. Possible values include: "Java_8", "Java_11", + "NetCore_31". Default value: "Java_8". + :paramtype runtime_version: str or + ~azure.mgmt.appplatform.v2021_06_01_preview.models.RuntimeVersion + """ super(DeploymentSettings, self).__init__(**kwargs) self.cpu = cpu self.memory_in_gb = memory_in_gb @@ -1324,10 +1576,10 @@ def __init__( class Error(msrest.serialization.Model): """The error code compose of code and message. - :param code: The code of error. - :type code: str - :param message: The message of error. - :type message: str + :ivar code: The code of error. + :vartype code: str + :ivar message: The message of error. + :vartype message: str """ _attribute_map = { @@ -1342,6 +1594,12 @@ def __init__( message: Optional[str] = None, **kwargs ): + """ + :keyword code: The code of error. + :paramtype code: str + :keyword message: The message of error. + :paramtype message: str + """ super(Error, self).__init__(**kwargs) self.code = code self.message = message @@ -1352,28 +1610,28 @@ class GitPatternRepository(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param name: Required. Name of the repository. - :type name: str - :param pattern: Collection of pattern of the repository. - :type pattern: list[str] - :param uri: Required. URI of the repository. - :type uri: str - :param label: Label of the repository. - :type label: str - :param search_paths: Searching path of the repository. - :type search_paths: list[str] - :param username: Username of git repository basic auth. - :type username: str - :param password: Password of git repository basic auth. - :type password: str - :param host_key: Public sshKey of git repository. - :type host_key: str - :param host_key_algorithm: SshKey algorithm of git repository. - :type host_key_algorithm: str - :param private_key: Private sshKey algorithm of git repository. - :type private_key: str - :param strict_host_key_checking: Strict host key checking or not. - :type strict_host_key_checking: bool + :ivar name: Required. Name of the repository. + :vartype name: str + :ivar pattern: Collection of pattern of the repository. + :vartype pattern: list[str] + :ivar uri: Required. URI of the repository. + :vartype uri: str + :ivar label: Label of the repository. + :vartype label: str + :ivar search_paths: Searching path of the repository. + :vartype search_paths: list[str] + :ivar username: Username of git repository basic auth. + :vartype username: str + :ivar password: Password of git repository basic auth. + :vartype password: str + :ivar host_key: Public sshKey of git repository. + :vartype host_key: str + :ivar host_key_algorithm: SshKey algorithm of git repository. + :vartype host_key_algorithm: str + :ivar private_key: Private sshKey algorithm of git repository. + :vartype private_key: str + :ivar strict_host_key_checking: Strict host key checking or not. + :vartype strict_host_key_checking: bool """ _validation = { @@ -1411,6 +1669,30 @@ def __init__( strict_host_key_checking: Optional[bool] = None, **kwargs ): + """ + :keyword name: Required. Name of the repository. + :paramtype name: str + :keyword pattern: Collection of pattern of the repository. + :paramtype pattern: list[str] + :keyword uri: Required. URI of the repository. + :paramtype uri: str + :keyword label: Label of the repository. + :paramtype label: str + :keyword search_paths: Searching path of the repository. + :paramtype search_paths: list[str] + :keyword username: Username of git repository basic auth. + :paramtype username: str + :keyword password: Password of git repository basic auth. + :paramtype password: str + :keyword host_key: Public sshKey of git repository. + :paramtype host_key: str + :keyword host_key_algorithm: SshKey algorithm of git repository. + :paramtype host_key_algorithm: str + :keyword private_key: Private sshKey algorithm of git repository. + :paramtype private_key: str + :keyword strict_host_key_checking: Strict host key checking or not. + :paramtype strict_host_key_checking: bool + """ super(GitPatternRepository, self).__init__(**kwargs) self.name = name self.pattern = pattern @@ -1428,10 +1710,10 @@ def __init__( 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 + :ivar username: The username of the image registry credential. + :vartype username: str + :ivar password: The password of the image registry credential. + :vartype password: str """ _attribute_map = { @@ -1446,6 +1728,12 @@ def __init__( password: Optional[str] = None, **kwargs ): + """ + :keyword username: The username of the image registry credential. + :paramtype username: str + :keyword password: The password of the image registry credential. + :paramtype password: str + """ super(ImageRegistryCredential, self).__init__(**kwargs) self.username = username self.password = password @@ -1456,8 +1744,8 @@ class LogFileUrlResponse(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param url: Required. URL of the log file. - :type url: str + :ivar url: Required. URL of the log file. + :vartype url: str """ _validation = { @@ -1474,6 +1762,10 @@ def __init__( url: str, **kwargs ): + """ + :keyword url: Required. URL of the log file. + :paramtype url: str + """ super(LogFileUrlResponse, self).__init__(**kwargs) self.url = url @@ -1481,12 +1773,12 @@ def __init__( class LogSpecification(msrest.serialization.Model): """Specifications of the Log for Azure Monitoring. - :param name: Name of the log. - :type name: str - :param display_name: Localized friendly display name of the log. - :type display_name: str - :param blob_duration: Blob duration of the log. - :type blob_duration: str + :ivar name: Name of the log. + :vartype name: str + :ivar display_name: Localized friendly display name of the log. + :vartype display_name: str + :ivar blob_duration: Blob duration of the log. + :vartype blob_duration: str """ _attribute_map = { @@ -1503,6 +1795,14 @@ def __init__( blob_duration: Optional[str] = None, **kwargs ): + """ + :keyword name: Name of the log. + :paramtype name: str + :keyword display_name: Localized friendly display name of the log. + :paramtype display_name: str + :keyword blob_duration: Blob duration of the log. + :paramtype blob_duration: str + """ super(LogSpecification, self).__init__(**kwargs) self.name = name self.display_name = display_name @@ -1512,13 +1812,13 @@ def __init__( 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", + :ivar 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. - :type tenant_id: str + :vartype type: str or ~azure.mgmt.appplatform.v2021_06_01_preview.models.ManagedIdentityType + :ivar principal_id: Principal Id. + :vartype principal_id: str + :ivar tenant_id: Tenant Id. + :vartype tenant_id: str """ _attribute_map = { @@ -1535,6 +1835,15 @@ def __init__( tenant_id: Optional[str] = None, **kwargs ): + """ + :keyword type: Type of the managed identity. Possible values include: "None", "SystemAssigned", + "UserAssigned", "SystemAssigned,UserAssigned". + :paramtype type: str or ~azure.mgmt.appplatform.v2021_06_01_preview.models.ManagedIdentityType + :keyword principal_id: Principal Id. + :paramtype principal_id: str + :keyword tenant_id: Tenant Id. + :paramtype tenant_id: str + """ super(ManagedIdentityProperties, self).__init__(**kwargs) self.type = type self.principal_id = principal_id @@ -1544,13 +1853,13 @@ def __init__( class MetricDimension(msrest.serialization.Model): """Specifications of the Dimension of metrics. - :param name: Name of the dimension. - :type name: str - :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 + :ivar name: Name of the dimension. + :vartype name: str + :ivar display_name: Localized friendly display name of the dimension. + :vartype display_name: str + :ivar to_be_exported_for_shoebox: Whether this dimension should be included for the Shoebox export scenario. - :type to_be_exported_for_shoebox: bool + :vartype to_be_exported_for_shoebox: bool """ _attribute_map = { @@ -1567,6 +1876,15 @@ def __init__( to_be_exported_for_shoebox: Optional[bool] = None, **kwargs ): + """ + :keyword name: Name of the dimension. + :paramtype name: str + :keyword display_name: Localized friendly display name of the dimension. + :paramtype display_name: str + :keyword to_be_exported_for_shoebox: Whether this dimension should be included for the Shoebox + export scenario. + :paramtype to_be_exported_for_shoebox: bool + """ super(MetricDimension, self).__init__(**kwargs) self.name = name self.display_name = display_name @@ -1576,29 +1894,31 @@ def __init__( class MetricSpecification(msrest.serialization.Model): """Specifications of the Metrics for Azure Monitoring. - :param name: Name of the metric. - :type name: str - :param display_name: Localized friendly display name of the metric. - :type display_name: str - :param display_description: Localized friendly description of the metric. - :type display_description: str - :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 + :ivar name: Name of the metric. + :vartype name: str + :ivar display_name: Localized friendly display name of the metric. + :vartype display_name: str + :ivar display_description: Localized friendly description of the metric. + :vartype display_description: str + :ivar unit: Unit that makes sense for the metric. + :vartype unit: str + :ivar 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, + :vartype category: str + :ivar 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. - :type supported_aggregation_types: list[str] - :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 + :vartype aggregation_type: str + :ivar supported_aggregation_types: Supported aggregation types. + :vartype supported_aggregation_types: list[str] + :ivar supported_time_grain_types: Supported time grain types. + :vartype supported_time_grain_types: list[str] + :ivar 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] + :vartype fill_gap_with_zero: bool + :ivar dimensions: Dimensions of the metric. + :vartype dimensions: list[~azure.mgmt.appplatform.v2021_06_01_preview.models.MetricDimension] + :ivar source_mdm_namespace: Name of the MDM namespace. Optional. + :vartype source_mdm_namespace: str """ _attribute_map = { @@ -1612,6 +1932,7 @@ class MetricSpecification(msrest.serialization.Model): 'supported_time_grain_types': {'key': 'supportedTimeGrainTypes', 'type': '[str]'}, 'fill_gap_with_zero': {'key': 'fillGapWithZero', 'type': 'bool'}, 'dimensions': {'key': 'dimensions', 'type': '[MetricDimension]'}, + 'source_mdm_namespace': {'key': 'sourceMdmNamespace', 'type': 'str'}, } def __init__( @@ -1627,8 +1948,36 @@ def __init__( supported_time_grain_types: Optional[List[str]] = None, fill_gap_with_zero: Optional[bool] = None, dimensions: Optional[List["MetricDimension"]] = None, - **kwargs - ): + source_mdm_namespace: Optional[str] = None, + **kwargs + ): + """ + :keyword name: Name of the metric. + :paramtype name: str + :keyword display_name: Localized friendly display name of the metric. + :paramtype display_name: str + :keyword display_description: Localized friendly description of the metric. + :paramtype display_description: str + :keyword unit: Unit that makes sense for the metric. + :paramtype unit: str + :keyword category: Name of the metric category that the metric belongs to. A metric can only + belong to a single category. + :paramtype category: str + :keyword aggregation_type: Only provide one value for this field. Valid values: Average, + Minimum, Maximum, Total, Count. + :paramtype aggregation_type: str + :keyword supported_aggregation_types: Supported aggregation types. + :paramtype supported_aggregation_types: list[str] + :keyword supported_time_grain_types: Supported time grain types. + :paramtype supported_time_grain_types: list[str] + :keyword fill_gap_with_zero: Optional. If set to true, then zero will be returned for time + duration where no metric is emitted/published. + :paramtype fill_gap_with_zero: bool + :keyword dimensions: Dimensions of the metric. + :paramtype dimensions: list[~azure.mgmt.appplatform.v2021_06_01_preview.models.MetricDimension] + :keyword source_mdm_namespace: Name of the MDM namespace. Optional. + :paramtype source_mdm_namespace: str + """ super(MetricSpecification, self).__init__(**kwargs) self.name = name self.display_name = display_name @@ -1640,6 +1989,7 @@ def __init__( self.supported_time_grain_types = supported_time_grain_types self.fill_gap_with_zero = fill_gap_with_zero self.dimensions = dimensions + self.source_mdm_namespace = source_mdm_namespace class MonitoringSettingProperties(msrest.serialization.Model): @@ -1651,20 +2001,20 @@ class MonitoringSettingProperties(msrest.serialization.Model): "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. - :type trace_enabled: bool - :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, + :ivar error: Error when apply Monitoring Setting changes. + :vartype error: ~azure.mgmt.appplatform.v2021_06_01_preview.models.Error + :ivar 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. + :vartype trace_enabled: bool + :ivar app_insights_instrumentation_key: Target application insight instrumentation key, null or + whitespace include empty will disable monitoringSettings. + :vartype app_insights_instrumentation_key: str + :ivar 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. - :type app_insights_agent_versions: + :vartype app_insights_sampling_rate: float + :ivar app_insights_agent_versions: Indicates the versions of application insight agent. + :vartype app_insights_agent_versions: ~azure.mgmt.appplatform.v2021_06_01_preview.models.ApplicationInsightsAgentVersions """ @@ -1692,6 +2042,23 @@ def __init__( app_insights_agent_versions: Optional["ApplicationInsightsAgentVersions"] = None, **kwargs ): + """ + :keyword error: Error when apply Monitoring Setting changes. + :paramtype error: ~azure.mgmt.appplatform.v2021_06_01_preview.models.Error + :keyword 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. + :paramtype trace_enabled: bool + :keyword app_insights_instrumentation_key: Target application insight instrumentation key, null + or whitespace include empty will disable monitoringSettings. + :paramtype app_insights_instrumentation_key: str + :keyword app_insights_sampling_rate: Indicates the sampling rate of application insight agent, + should be in range [0.0, 100.0]. + :paramtype app_insights_sampling_rate: float + :keyword app_insights_agent_versions: Indicates the versions of application insight agent. + :paramtype app_insights_agent_versions: + ~azure.mgmt.appplatform.v2021_06_01_preview.models.ApplicationInsightsAgentVersions + """ super(MonitoringSettingProperties, self).__init__(**kwargs) self.provisioning_state = None self.error = error @@ -1712,8 +2079,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: + :ivar properties: Properties of the Monitoring Setting resource. + :vartype properties: ~azure.mgmt.appplatform.v2021_06_01_preview.models.MonitoringSettingProperties """ @@ -1736,6 +2103,11 @@ def __init__( properties: Optional["MonitoringSettingProperties"] = None, **kwargs ): + """ + :keyword properties: Properties of the Monitoring Setting resource. + :paramtype properties: + ~azure.mgmt.appplatform.v2021_06_01_preview.models.MonitoringSettingProperties + """ super(MonitoringSettingResource, self).__init__(**kwargs) self.properties = properties @@ -1743,12 +2115,12 @@ def __init__( class NameAvailability(msrest.serialization.Model): """Name availability result payload. - :param name_available: Indicates whether the name is available. - :type name_available: bool - :param reason: Reason why the name is not available. - :type reason: str - :param message: Message why the name is not available. - :type message: str + :ivar name_available: Indicates whether the name is available. + :vartype name_available: bool + :ivar reason: Reason why the name is not available. + :vartype reason: str + :ivar message: Message why the name is not available. + :vartype message: str """ _attribute_map = { @@ -1765,6 +2137,14 @@ def __init__( message: Optional[str] = None, **kwargs ): + """ + :keyword name_available: Indicates whether the name is available. + :paramtype name_available: bool + :keyword reason: Reason why the name is not available. + :paramtype reason: str + :keyword message: Message why the name is not available. + :paramtype message: str + """ super(NameAvailability, self).__init__(**kwargs) self.name_available = name_available self.reason = reason @@ -1776,10 +2156,10 @@ class NameAvailabilityParameters(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param type: Required. Type of the resource to check name availability. - :type type: str - :param name: Required. Name to be checked. - :type name: str + :ivar type: Required. Type of the resource to check name availability. + :vartype type: str + :ivar name: Required. Name to be checked. + :vartype name: str """ _validation = { @@ -1799,6 +2179,12 @@ def __init__( name: str, **kwargs ): + """ + :keyword type: Required. Type of the resource to check name availability. + :paramtype type: str + :keyword name: Required. Name to be checked. + :paramtype name: str + """ super(NameAvailabilityParameters, self).__init__(**kwargs) self.type = type self.name = name @@ -1809,20 +2195,19 @@ class NetworkProfile(msrest.serialization.Model): 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. - :type service_runtime_subnet_id: str - :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. - :type service_cidr: str - :param service_runtime_network_resource_group: Name of the resource group containing network + :ivar service_runtime_subnet_id: Fully qualified resource Id of the subnet to host Azure Spring + Cloud Service Runtime. + :vartype service_runtime_subnet_id: str + :ivar app_subnet_id: Fully qualified resource Id of the subnet to host Azure Spring Cloud Apps. + :vartype app_subnet_id: str + :ivar service_cidr: Azure Spring Cloud service reserved CIDR. + :vartype service_cidr: str + :ivar 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 + :vartype service_runtime_network_resource_group: str + :ivar app_network_resource_group: Name of the resource group containing network resources of Azure Spring Cloud Apps. - :type app_network_resource_group: str + :vartype app_network_resource_group: str :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 @@ -1856,6 +2241,22 @@ def __init__( app_network_resource_group: Optional[str] = None, **kwargs ): + """ + :keyword service_runtime_subnet_id: Fully qualified resource Id of the subnet to host Azure + Spring Cloud Service Runtime. + :paramtype service_runtime_subnet_id: str + :keyword app_subnet_id: Fully qualified resource Id of the subnet to host Azure Spring Cloud + Apps. + :paramtype app_subnet_id: str + :keyword service_cidr: Azure Spring Cloud service reserved CIDR. + :paramtype service_cidr: str + :keyword service_runtime_network_resource_group: Name of the resource group containing network + resources of Azure Spring Cloud Service Runtime. + :paramtype service_runtime_network_resource_group: str + :keyword app_network_resource_group: Name of the resource group containing network resources of + Azure Spring Cloud Apps. + :paramtype app_network_resource_group: str + """ super(NetworkProfile, self).__init__(**kwargs) self.service_runtime_subnet_id = service_runtime_subnet_id self.app_subnet_id = app_subnet_id @@ -1887,6 +2288,8 @@ def __init__( self, **kwargs ): + """ + """ super(NetworkProfileOutboundIPs, self).__init__(**kwargs) self.public_i_ps = None @@ -1894,22 +2297,32 @@ def __init__( class OperationDetail(msrest.serialization.Model): """Operation detail payload. - :param name: Name of the operation. - :type name: str - :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. - :type origin: str - :param properties: Properties of the operation. - :type properties: ~azure.mgmt.appplatform.v2021_06_01_preview.models.OperationProperties + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar name: Name of the operation. + :vartype name: str + :ivar is_data_action: Indicates whether the operation is a data action. + :vartype is_data_action: bool + :ivar display: Display of the operation. + :vartype display: ~azure.mgmt.appplatform.v2021_06_01_preview.models.OperationDisplay + :ivar action_type: Enum. Indicates the action type. "Internal" refers to actions that are for + internal only APIs. Possible values include: "Internal". + :vartype action_type: str or ~azure.mgmt.appplatform.v2021_06_01_preview.models.ActionType + :ivar origin: Origin of the operation. + :vartype origin: str + :ivar properties: Properties of the operation. + :vartype properties: ~azure.mgmt.appplatform.v2021_06_01_preview.models.OperationProperties """ + _validation = { + 'action_type': {'readonly': True}, + } + _attribute_map = { 'name': {'key': 'name', 'type': 'str'}, 'is_data_action': {'key': 'isDataAction', 'type': 'bool'}, 'display': {'key': 'display', 'type': 'OperationDisplay'}, + 'action_type': {'key': 'actionType', 'type': 'str'}, 'origin': {'key': 'origin', 'type': 'str'}, 'properties': {'key': 'properties', 'type': 'OperationProperties'}, } @@ -1924,10 +2337,23 @@ def __init__( properties: Optional["OperationProperties"] = None, **kwargs ): + """ + :keyword name: Name of the operation. + :paramtype name: str + :keyword is_data_action: Indicates whether the operation is a data action. + :paramtype is_data_action: bool + :keyword display: Display of the operation. + :paramtype display: ~azure.mgmt.appplatform.v2021_06_01_preview.models.OperationDisplay + :keyword origin: Origin of the operation. + :paramtype origin: str + :keyword properties: Properties of the operation. + :paramtype properties: ~azure.mgmt.appplatform.v2021_06_01_preview.models.OperationProperties + """ super(OperationDetail, self).__init__(**kwargs) self.name = name self.is_data_action = is_data_action self.display = display + self.action_type = None self.origin = origin self.properties = properties @@ -1935,14 +2361,14 @@ def __init__( class OperationDisplay(msrest.serialization.Model): """Operation display payload. - :param provider: Resource provider of the operation. - :type provider: str - :param resource: Resource of the operation. - :type resource: str - :param operation: Localized friendly name for the operation. - :type operation: str - :param description: Localized friendly description for the operation. - :type description: str + :ivar provider: Resource provider of the operation. + :vartype provider: str + :ivar resource: Resource of the operation. + :vartype resource: str + :ivar operation: Localized friendly name for the operation. + :vartype operation: str + :ivar description: Localized friendly description for the operation. + :vartype description: str """ _attribute_map = { @@ -1961,6 +2387,16 @@ def __init__( description: Optional[str] = None, **kwargs ): + """ + :keyword provider: Resource provider of the operation. + :paramtype provider: str + :keyword resource: Resource of the operation. + :paramtype resource: str + :keyword operation: Localized friendly name for the operation. + :paramtype operation: str + :keyword description: Localized friendly description for the operation. + :paramtype description: str + """ super(OperationDisplay, self).__init__(**kwargs) self.provider = provider self.resource = resource @@ -1971,8 +2407,8 @@ def __init__( class OperationProperties(msrest.serialization.Model): """Extra Operation properties. - :param service_specification: Service specifications of the operation. - :type service_specification: + :ivar service_specification: Service specifications of the operation. + :vartype service_specification: ~azure.mgmt.appplatform.v2021_06_01_preview.models.ServiceSpecification """ @@ -1986,6 +2422,11 @@ def __init__( service_specification: Optional["ServiceSpecification"] = None, **kwargs ): + """ + :keyword service_specification: Service specifications of the operation. + :paramtype service_specification: + ~azure.mgmt.appplatform.v2021_06_01_preview.models.ServiceSpecification + """ super(OperationProperties, self).__init__(**kwargs) self.service_specification = service_specification @@ -1995,12 +2436,12 @@ class PersistentDisk(msrest.serialization.Model): 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. - :type size_in_gb: int + :ivar size_in_gb: Size of the persistent disk in GB. + :vartype size_in_gb: int :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. - :type mount_path: str + :ivar mount_path: Mount path of the persistent disk. + :vartype mount_path: str """ _validation = { @@ -2021,6 +2462,12 @@ def __init__( mount_path: Optional[str] = None, **kwargs ): + """ + :keyword size_in_gb: Size of the persistent disk in GB. + :paramtype size_in_gb: int + :keyword mount_path: Mount path of the persistent disk. + :paramtype mount_path: str + """ super(PersistentDisk, self).__init__(**kwargs) self.size_in_gb = size_in_gb self.used_in_gb = None @@ -2032,9 +2479,9 @@ class RegenerateTestKeyRequestPayload(msrest.serialization.Model): 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", + :ivar 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 + :vartype key_type: str or ~azure.mgmt.appplatform.v2021_06_01_preview.models.TestKeyType """ _validation = { @@ -2051,6 +2498,11 @@ def __init__( key_type: Union[str, "TestKeyType"], **kwargs ): + """ + :keyword key_type: Required. Type of the test key. Possible values include: "Primary", + "Secondary". + :paramtype key_type: str or ~azure.mgmt.appplatform.v2021_06_01_preview.models.TestKeyType + """ super(RegenerateTestKeyRequestPayload, self).__init__(**kwargs) self.key_type = key_type @@ -2093,6 +2545,8 @@ def __init__( self, **kwargs ): + """ + """ super(RequiredTraffic, self).__init__(**kwargs) self.protocol = None self.port = None @@ -2104,12 +2558,12 @@ def __init__( 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 + :ivar 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. - :type memory: str + :vartype cpu: str + :ivar 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. + :vartype memory: str """ _attribute_map = { @@ -2124,6 +2578,14 @@ def __init__( memory: Optional[str] = None, **kwargs ): + """ + :keyword 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. + :paramtype cpu: str + :keyword 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. + :paramtype memory: str + """ super(ResourceRequests, self).__init__(**kwargs) self.cpu = cpu self.memory = memory @@ -2132,23 +2594,23 @@ def __init__( class ResourceSku(msrest.serialization.Model): """Describes an available Azure Spring Cloud SKU. - :param resource_type: Gets the type of resource the SKU applies to. - :type resource_type: str - :param name: Gets the name of SKU. - :type name: str - :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 - :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 + :ivar resource_type: Gets the type of resource the SKU applies to. + :vartype resource_type: str + :ivar name: Gets the name of SKU. + :vartype name: str + :ivar tier: Gets the tier of SKU. + :vartype tier: str + :ivar capacity: Gets the capacity of SKU. + :vartype capacity: ~azure.mgmt.appplatform.v2021_06_01_preview.models.SkuCapacity + :ivar locations: Gets the set of locations that the SKU is available. + :vartype locations: list[str] + :ivar location_info: Gets a list of locations and availability zones in those locations where the SKU is available. - :type location_info: + :vartype 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 + :ivar restrictions: Gets the restrictions because of which SKU cannot be used. This is empty if there are no restrictions. - :type restrictions: + :vartype restrictions: list[~azure.mgmt.appplatform.v2021_06_01_preview.models.ResourceSkuRestrictions] """ @@ -2174,6 +2636,26 @@ def __init__( restrictions: Optional[List["ResourceSkuRestrictions"]] = None, **kwargs ): + """ + :keyword resource_type: Gets the type of resource the SKU applies to. + :paramtype resource_type: str + :keyword name: Gets the name of SKU. + :paramtype name: str + :keyword tier: Gets the tier of SKU. + :paramtype tier: str + :keyword capacity: Gets the capacity of SKU. + :paramtype capacity: ~azure.mgmt.appplatform.v2021_06_01_preview.models.SkuCapacity + :keyword locations: Gets the set of locations that the SKU is available. + :paramtype locations: list[str] + :keyword location_info: Gets a list of locations and availability zones in those locations + where the SKU is available. + :paramtype location_info: + list[~azure.mgmt.appplatform.v2021_06_01_preview.models.ResourceSkuLocationInfo] + :keyword restrictions: Gets the restrictions because of which SKU cannot be used. This is + empty if there are no restrictions. + :paramtype restrictions: + list[~azure.mgmt.appplatform.v2021_06_01_preview.models.ResourceSkuRestrictions] + """ super(ResourceSku, self).__init__(**kwargs) self.resource_type = resource_type self.name = name @@ -2187,10 +2669,10 @@ def __init__( class ResourceSkuCapabilities(msrest.serialization.Model): """ResourceSkuCapabilities. - :param name: Gets an invariant to describe the feature. - :type name: str - :param value: Gets an invariant if the feature is measured by quantity. - :type value: str + :ivar name: Gets an invariant to describe the feature. + :vartype name: str + :ivar value: Gets an invariant if the feature is measured by quantity. + :vartype value: str """ _attribute_map = { @@ -2205,6 +2687,12 @@ def __init__( value: Optional[str] = None, **kwargs ): + """ + :keyword name: Gets an invariant to describe the feature. + :paramtype name: str + :keyword value: Gets an invariant if the feature is measured by quantity. + :paramtype value: str + """ super(ResourceSkuCapabilities, self).__init__(**kwargs) self.name = name self.value = value @@ -2213,11 +2701,11 @@ def __init__( 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). + :ivar value: Collection of resource SKU. + :vartype value: list[~azure.mgmt.appplatform.v2021_06_01_preview.models.ResourceSku] + :ivar 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 + :vartype next_link: str """ _attribute_map = { @@ -2232,6 +2720,13 @@ def __init__( next_link: Optional[str] = None, **kwargs ): + """ + :keyword value: Collection of resource SKU. + :paramtype value: list[~azure.mgmt.appplatform.v2021_06_01_preview.models.ResourceSku] + :keyword next_link: URL client should use to fetch the next page (per server side paging). + It's null for now, added for future use. + :paramtype next_link: str + """ super(ResourceSkuCollection, self).__init__(**kwargs) self.value = value self.next_link = next_link @@ -2240,12 +2735,12 @@ def __init__( class ResourceSkuLocationInfo(msrest.serialization.Model): """Locations and availability zones where the SKU is available. - :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: + :ivar location: Gets location of the SKU. + :vartype location: str + :ivar zones: Gets list of availability zones where the SKU is supported. + :vartype zones: list[str] + :ivar zone_details: Gets details of capabilities available to a SKU in specific zones. + :vartype zone_details: list[~azure.mgmt.appplatform.v2021_06_01_preview.models.ResourceSkuZoneDetails] """ @@ -2263,6 +2758,15 @@ def __init__( zone_details: Optional[List["ResourceSkuZoneDetails"]] = None, **kwargs ): + """ + :keyword location: Gets location of the SKU. + :paramtype location: str + :keyword zones: Gets list of availability zones where the SKU is supported. + :paramtype zones: list[str] + :keyword zone_details: Gets details of capabilities available to a SKU in specific zones. + :paramtype zone_details: + list[~azure.mgmt.appplatform.v2021_06_01_preview.models.ResourceSkuZoneDetails] + """ super(ResourceSkuLocationInfo, self).__init__(**kwargs) self.location = location self.zones = zones @@ -2272,10 +2776,10 @@ def __init__( class ResourceSkuRestrictionInfo(msrest.serialization.Model): """Information about the restriction where the SKU cannot be used. - :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] + :ivar locations: Gets locations where the SKU is restricted. + :vartype locations: list[str] + :ivar zones: Gets list of availability zones where the SKU is restricted. + :vartype zones: list[str] """ _attribute_map = { @@ -2290,6 +2794,12 @@ def __init__( zones: Optional[List[str]] = None, **kwargs ): + """ + :keyword locations: Gets locations where the SKU is restricted. + :paramtype locations: list[str] + :keyword zones: Gets list of availability zones where the SKU is restricted. + :paramtype zones: list[str] + """ super(ResourceSkuRestrictionInfo, self).__init__(**kwargs) self.locations = locations self.zones = zones @@ -2298,21 +2808,21 @@ def __init__( class ResourceSkuRestrictions(msrest.serialization.Model): """Restrictions where the SKU cannot be used. - :param type: Gets the type of restrictions. Possible values include: 'Location', 'Zone'. + :ivar type: Gets the type of restrictions. Possible values include: 'Location', 'Zone'. Possible values include: "Location", "Zone". - :type type: str or + :vartype 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 + :ivar 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 + :vartype values: list[str] + :ivar restriction_info: Gets the information about the restriction where the SKU cannot be used. - :type restriction_info: + :vartype restriction_info: ~azure.mgmt.appplatform.v2021_06_01_preview.models.ResourceSkuRestrictionInfo - :param reason_code: Gets the reason for restriction. Possible values include: 'QuotaId', + :ivar reason_code: Gets the reason for restriction. Possible values include: 'QuotaId', 'NotAvailableForSubscription'. Possible values include: "QuotaId", "NotAvailableForSubscription". - :type reason_code: str or + :vartype reason_code: str or ~azure.mgmt.appplatform.v2021_06_01_preview.models.ResourceSkuRestrictionsReasonCode """ @@ -2332,6 +2842,24 @@ def __init__( reason_code: Optional[Union[str, "ResourceSkuRestrictionsReasonCode"]] = None, **kwargs ): + """ + :keyword type: Gets the type of restrictions. Possible values include: 'Location', 'Zone'. + Possible values include: "Location", "Zone". + :paramtype type: str or + ~azure.mgmt.appplatform.v2021_06_01_preview.models.ResourceSkuRestrictionsType + :keyword values: Gets the value of restrictions. If the restriction type is set to + location. This would be different locations where the SKU is restricted. + :paramtype values: list[str] + :keyword restriction_info: Gets the information about the restriction where the SKU cannot be + used. + :paramtype restriction_info: + ~azure.mgmt.appplatform.v2021_06_01_preview.models.ResourceSkuRestrictionInfo + :keyword reason_code: Gets the reason for restriction. Possible values include: 'QuotaId', + 'NotAvailableForSubscription'. Possible values include: "QuotaId", + "NotAvailableForSubscription". + :paramtype reason_code: str or + ~azure.mgmt.appplatform.v2021_06_01_preview.models.ResourceSkuRestrictionsReasonCode + """ super(ResourceSkuRestrictions, self).__init__(**kwargs) self.type = type self.values = values @@ -2342,12 +2870,12 @@ def __init__( 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 + :ivar 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 + :vartype name: list[str] + :ivar capabilities: Gets a list of capabilities that are available for the SKU in the specified list of zones. - :type capabilities: + :vartype capabilities: list[~azure.mgmt.appplatform.v2021_06_01_preview.models.ResourceSkuCapabilities] """ @@ -2363,6 +2891,15 @@ def __init__( capabilities: Optional[List["ResourceSkuCapabilities"]] = None, **kwargs ): + """ + :keyword name: Gets the set of zones that the SKU is available in with the + specified capabilities. + :paramtype name: list[str] + :keyword capabilities: Gets a list of capabilities that are available for the SKU in the + specified list of zones. + :paramtype capabilities: + list[~azure.mgmt.appplatform.v2021_06_01_preview.models.ResourceSkuCapabilities] + """ super(ResourceSkuZoneDetails, self).__init__(**kwargs) self.name = name self.capabilities = capabilities @@ -2371,10 +2908,10 @@ def __init__( class ResourceUploadDefinition(msrest.serialization.Model): """Resource upload definition payload. - :param relative_path: Source relative path. - :type relative_path: str - :param upload_url: Upload URL. - :type upload_url: str + :ivar relative_path: Source relative path. + :vartype relative_path: str + :ivar upload_url: Upload URL. + :vartype upload_url: str """ _attribute_map = { @@ -2389,6 +2926,12 @@ def __init__( upload_url: Optional[str] = None, **kwargs ): + """ + :keyword relative_path: Source relative path. + :paramtype relative_path: str + :keyword upload_url: Upload URL. + :paramtype upload_url: str + """ super(ResourceUploadDefinition, self).__init__(**kwargs) self.relative_path = relative_path self.upload_url = upload_url @@ -2405,11 +2948,11 @@ class TrackedResource(Resource): :vartype name: str :ivar type: The type of the resource. :vartype type: str - :param location: The GEO location of the resource. - :type location: str - :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] + :ivar location: The GEO location of the resource. + :vartype location: str + :ivar tags: A set of tags. Tags of the service which is a list of key value pairs that describe + the resource. + :vartype tags: dict[str, str] """ _validation = { @@ -2433,6 +2976,13 @@ def __init__( tags: Optional[Dict[str, str]] = None, **kwargs ): + """ + :keyword location: The GEO location of the resource. + :paramtype location: str + :keyword tags: A set of tags. Tags of the service which is a list of key value pairs that + describe the resource. + :paramtype tags: dict[str, str] + """ super(TrackedResource, self).__init__(**kwargs) self.location = location self.tags = tags @@ -2449,15 +2999,16 @@ class ServiceResource(TrackedResource): :vartype name: str :ivar type: The type of the resource. :vartype type: str - :param location: The GEO location of the resource. - :type location: str - :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. - :type sku: ~azure.mgmt.appplatform.v2021_06_01_preview.models.Sku + :ivar location: The GEO location of the resource. + :vartype location: str + :ivar tags: A set of tags. Tags of the service which is a list of key value pairs that describe + the resource. + :vartype tags: dict[str, str] + :ivar properties: Properties of the Service resource. + :vartype properties: + ~azure.mgmt.appplatform.v2021_06_01_preview.models.ClusterResourceProperties + :ivar sku: Sku of the Service resource. + :vartype sku: ~azure.mgmt.appplatform.v2021_06_01_preview.models.Sku """ _validation = { @@ -2485,6 +3036,18 @@ def __init__( sku: Optional["Sku"] = None, **kwargs ): + """ + :keyword location: The GEO location of the resource. + :paramtype location: str + :keyword tags: A set of tags. Tags of the service which is a list of key value pairs that + describe the resource. + :paramtype tags: dict[str, str] + :keyword properties: Properties of the Service resource. + :paramtype properties: + ~azure.mgmt.appplatform.v2021_06_01_preview.models.ClusterResourceProperties + :keyword sku: Sku of the Service resource. + :paramtype sku: ~azure.mgmt.appplatform.v2021_06_01_preview.models.Sku + """ super(ServiceResource, self).__init__(location=location, tags=tags, **kwargs) self.properties = properties self.sku = sku @@ -2493,11 +3056,11 @@ def __init__( 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). + :ivar value: Collection of Service resources. + :vartype value: list[~azure.mgmt.appplatform.v2021_06_01_preview.models.ServiceResource] + :ivar 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 + :vartype next_link: str """ _attribute_map = { @@ -2512,6 +3075,13 @@ def __init__( next_link: Optional[str] = None, **kwargs ): + """ + :keyword value: Collection of Service resources. + :paramtype value: list[~azure.mgmt.appplatform.v2021_06_01_preview.models.ServiceResource] + :keyword next_link: URL client should use to fetch the next page (per server side paging). + It's null for now, added for future use. + :paramtype next_link: str + """ super(ServiceResourceList, self).__init__(**kwargs) self.value = value self.next_link = next_link @@ -2520,11 +3090,11 @@ def __init__( class ServiceSpecification(msrest.serialization.Model): """Service specification payload. - :param log_specifications: Specifications of the Log for Azure Monitoring. - :type log_specifications: + :ivar log_specifications: Specifications of the Log for Azure Monitoring. + :vartype log_specifications: list[~azure.mgmt.appplatform.v2021_06_01_preview.models.LogSpecification] - :param metric_specifications: Specifications of the Metrics for Azure Monitoring. - :type metric_specifications: + :ivar metric_specifications: Specifications of the Metrics for Azure Monitoring. + :vartype metric_specifications: list[~azure.mgmt.appplatform.v2021_06_01_preview.models.MetricSpecification] """ @@ -2540,6 +3110,14 @@ def __init__( metric_specifications: Optional[List["MetricSpecification"]] = None, **kwargs ): + """ + :keyword log_specifications: Specifications of the Log for Azure Monitoring. + :paramtype log_specifications: + list[~azure.mgmt.appplatform.v2021_06_01_preview.models.LogSpecification] + :keyword metric_specifications: Specifications of the Metrics for Azure Monitoring. + :paramtype metric_specifications: + list[~azure.mgmt.appplatform.v2021_06_01_preview.models.MetricSpecification] + """ super(ServiceSpecification, self).__init__(**kwargs) self.log_specifications = log_specifications self.metric_specifications = metric_specifications @@ -2548,12 +3126,12 @@ def __init__( class Sku(msrest.serialization.Model): """Sku of Azure Spring Cloud. - :param name: Name of the Sku. - :type name: str - :param tier: Tier of the Sku. - :type tier: str - :param capacity: Current capacity of the target resource. - :type capacity: int + :ivar name: Name of the Sku. + :vartype name: str + :ivar tier: Tier of the Sku. + :vartype tier: str + :ivar capacity: Current capacity of the target resource. + :vartype capacity: int """ _attribute_map = { @@ -2570,6 +3148,14 @@ def __init__( capacity: Optional[int] = None, **kwargs ): + """ + :keyword name: Name of the Sku. + :paramtype name: str + :keyword tier: Tier of the Sku. + :paramtype tier: str + :keyword capacity: Current capacity of the target resource. + :paramtype capacity: int + """ super(Sku, self).__init__(**kwargs) self.name = name self.tier = tier @@ -2581,15 +3167,15 @@ class SkuCapacity(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param minimum: Required. Gets or sets the minimum. - :type minimum: int - :param maximum: Gets or sets the maximum. - :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", + :ivar minimum: Required. Gets or sets the minimum. + :vartype minimum: int + :ivar maximum: Gets or sets the maximum. + :vartype maximum: int + :ivar default: Gets or sets the default. + :vartype default: int + :ivar 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 + :vartype scale_type: str or ~azure.mgmt.appplatform.v2021_06_01_preview.models.SkuScaleType """ _validation = { @@ -2612,6 +3198,17 @@ def __init__( scale_type: Optional[Union[str, "SkuScaleType"]] = None, **kwargs ): + """ + :keyword minimum: Required. Gets or sets the minimum. + :paramtype minimum: int + :keyword maximum: Gets or sets the maximum. + :paramtype maximum: int + :keyword default: Gets or sets the default. + :paramtype default: int + :keyword scale_type: Gets or sets the type of the scale. Possible values include: "None", + "Manual", "Automatic". + :paramtype scale_type: str or ~azure.mgmt.appplatform.v2021_06_01_preview.models.SkuScaleType + """ super(SkuCapacity, self).__init__(**kwargs) self.minimum = minimum self.maximum = maximum @@ -2622,15 +3219,15 @@ def __init__( 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"). + :ivar value: The raw value which could be passed to deployment CRUD operations. Possible values + include: "Java_8", "Java_11", "NetCore_31". + :vartype value: str or ~azure.mgmt.appplatform.v2021_06_01_preview.models.SupportedRuntimeValue + :ivar platform: The platform of this runtime version (possible values: "Java" or ".NET"). Possible values include: "Java", ".NET Core". - :type platform: str or + :vartype platform: str or ~azure.mgmt.appplatform.v2021_06_01_preview.models.SupportedRuntimePlatform - :param version: The detailed version (major.minor) of the platform. - :type version: str + :ivar version: The detailed version (major.minor) of the platform. + :vartype version: str """ _attribute_map = { @@ -2647,6 +3244,18 @@ def __init__( version: Optional[str] = None, **kwargs ): + """ + :keyword value: The raw value which could be passed to deployment CRUD operations. Possible + values include: "Java_8", "Java_11", "NetCore_31". + :paramtype value: str or + ~azure.mgmt.appplatform.v2021_06_01_preview.models.SupportedRuntimeValue + :keyword platform: The platform of this runtime version (possible values: "Java" or ".NET"). + Possible values include: "Java", ".NET Core". + :paramtype platform: str or + ~azure.mgmt.appplatform.v2021_06_01_preview.models.SupportedRuntimePlatform + :keyword version: The detailed version (major.minor) of the platform. + :paramtype version: str + """ super(SupportedRuntimeVersion, self).__init__(**kwargs) self.value = value self.platform = platform @@ -2656,10 +3265,10 @@ def __init__( class TemporaryDisk(msrest.serialization.Model): """Temporary disk payload. - :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. - :type mount_path: str + :ivar size_in_gb: Size of the temporary disk in GB. + :vartype size_in_gb: int + :ivar mount_path: Mount path of the temporary disk. + :vartype mount_path: str """ _validation = { @@ -2675,9 +3284,15 @@ def __init__( self, *, size_in_gb: Optional[int] = None, - mount_path: Optional[str] = None, + mount_path: Optional[str] = "/tmp", **kwargs ): + """ + :keyword size_in_gb: Size of the temporary disk in GB. + :paramtype size_in_gb: int + :keyword mount_path: Mount path of the temporary disk. + :paramtype mount_path: str + """ super(TemporaryDisk, self).__init__(**kwargs) self.size_in_gb = size_in_gb self.mount_path = mount_path @@ -2686,16 +3301,16 @@ def __init__( class TestKeys(msrest.serialization.Model): """Test keys payload. - :param primary_key: Primary key. - :type primary_key: str - :param secondary_key: Secondary key. - :type secondary_key: str - :param primary_test_endpoint: Primary test endpoint. - :type primary_test_endpoint: str - :param secondary_test_endpoint: Secondary test endpoint. - :type secondary_test_endpoint: str - :param enabled: Indicates whether the test endpoint feature enabled or not. - :type enabled: bool + :ivar primary_key: Primary key. + :vartype primary_key: str + :ivar secondary_key: Secondary key. + :vartype secondary_key: str + :ivar primary_test_endpoint: Primary test endpoint. + :vartype primary_test_endpoint: str + :ivar secondary_test_endpoint: Secondary test endpoint. + :vartype secondary_test_endpoint: str + :ivar enabled: Indicates whether the test endpoint feature enabled or not. + :vartype enabled: bool """ _attribute_map = { @@ -2716,6 +3331,18 @@ def __init__( enabled: Optional[bool] = None, **kwargs ): + """ + :keyword primary_key: Primary key. + :paramtype primary_key: str + :keyword secondary_key: Secondary key. + :paramtype secondary_key: str + :keyword primary_test_endpoint: Primary test endpoint. + :paramtype primary_test_endpoint: str + :keyword secondary_test_endpoint: Secondary test endpoint. + :paramtype secondary_test_endpoint: str + :keyword enabled: Indicates whether the test endpoint feature enabled or not. + :paramtype enabled: bool + """ super(TestKeys, self).__init__(**kwargs) self.primary_key = primary_key self.secondary_key = secondary_key @@ -2727,19 +3354,19 @@ def __init__( class UserSourceInfo(msrest.serialization.Model): """Source information for a deployment. - :param type: Type of the source uploaded. Possible values include: "Jar", "NetCoreZip", + :ivar 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. - :type version: str - :param artifact_selector: Selector for the artifact to be used for the deployment for + :vartype type: str or ~azure.mgmt.appplatform.v2021_06_01_preview.models.UserSourceType + :ivar relative_path: Relative path of the storage which stores the source. + :vartype relative_path: str + :ivar version: Version of the source. + :vartype version: str + :ivar 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 + :vartype artifact_selector: str + :ivar custom_container: Custom container payload. + :vartype custom_container: ~azure.mgmt.appplatform.v2021_06_01_preview.models.CustomContainer """ _attribute_map = { @@ -2760,6 +3387,21 @@ def __init__( custom_container: Optional["CustomContainer"] = None, **kwargs ): + """ + :keyword type: Type of the source uploaded. Possible values include: "Jar", "NetCoreZip", + "Source", "Container". + :paramtype type: str or ~azure.mgmt.appplatform.v2021_06_01_preview.models.UserSourceType + :keyword relative_path: Relative path of the storage which stores the source. + :paramtype relative_path: str + :keyword version: Version of the source. + :paramtype version: str + :keyword 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. + :paramtype artifact_selector: str + :keyword custom_container: Custom container payload. + :paramtype custom_container: ~azure.mgmt.appplatform.v2021_06_01_preview.models.CustomContainer + """ super(UserSourceInfo, self).__init__(**kwargs) self.type = type self.relative_path = relative_path diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2021_06_01_preview/operations/_apps_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2021_06_01_preview/operations/_apps_operations.py index eea853d993383..8933a929eb890 100644 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2021_06_01_preview/operations/_apps_operations.py +++ b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2021_06_01_preview/operations/_apps_operations.py @@ -5,26 +5,314 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools from typing import TYPE_CHECKING import warnings 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.pipeline.transport import HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling +from msrest import Serializer from .. import models as _models +from .._vendor import _convert_request, _format_url_section 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]] +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False +# fmt: off + +def build_get_request( + subscription_id, # type: str + resource_group_name, # type: str + service_name, # type: str + app_name, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + sync_status = kwargs.pop('sync_status', None) # type: Optional[str] + + api_version = "2021-06-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), + "appName": _SERIALIZER.url("app_name", app_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + if sync_status is not None: + query_parameters['syncStatus'] = _SERIALIZER.query("sync_status", sync_status, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_create_or_update_request_initial( + subscription_id, # type: str + resource_group_name, # type: str + service_name, # type: str + app_name, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2021-06-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), + "appName": _SERIALIZER.url("app_name", app_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_delete_request_initial( + subscription_id, # type: str + resource_group_name, # type: str + service_name, # type: str + app_name, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + api_version = "2021-06-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), + "appName": _SERIALIZER.url("app_name", app_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="DELETE", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_update_request_initial( + subscription_id, # type: str + resource_group_name, # type: str + service_name, # type: str + app_name, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2021-06-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), + "appName": _SERIALIZER.url("app_name", app_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PATCH", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_list_request( + subscription_id, # type: str + resource_group_name, # type: str + service_name, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + api_version = "2021-06-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_get_resource_upload_url_request( + subscription_id, # type: str + resource_group_name, # type: str + service_name, # type: str + app_name, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + api_version = "2021-06-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/getResourceUploadUrl') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), + "appName": _SERIALIZER.url("app_name", app_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_validate_domain_request( + subscription_id, # type: str + resource_group_name, # type: str + service_name, # type: str + app_name, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2021-06-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/validateDomain') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), + "appName": _SERIALIZER.url("app_name", app_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + +# fmt: on class AppsOperations(object): """AppsOperations operations. @@ -47,6 +335,7 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def get( self, resource_group_name, # type: str @@ -77,30 +366,19 @@ def get( 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 = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + sync_status=sync_status, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -114,8 +392,10 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized + 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, # type: str @@ -130,33 +410,23 @@ def _create_or_update_initial( 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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = self._serialize.body(app_resource, 'AppResource') + + request = build_create_or_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -177,8 +447,11 @@ def _create_or_update_initial( 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 + + @distributed_trace def begin_create_or_update( self, resource_group_name, # type: str @@ -201,15 +474,20 @@ def begin_create_or_update( :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. + :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: + :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 """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.AppResource"] lro_delay = kwargs.pop( 'polling_interval', @@ -222,28 +500,21 @@ def begin_create_or_update( service_name=service_name, app_name=app_name, app_resource=app_resource, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_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 = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -255,6 +526,7 @@ def get_long_running_output(pipeline_response): ) 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( @@ -270,28 +542,18 @@ def _delete_initial( 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 = build_delete_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -304,6 +566,8 @@ def _delete_initial( _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}'} # type: ignore + + @distributed_trace def begin_delete( self, resource_group_name, # type: str @@ -323,15 +587,17 @@ def begin_delete( :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 ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :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. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -346,22 +612,14 @@ def begin_delete( 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 = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -373,6 +631,7 @@ def get_long_running_output(pipeline_response): ) 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( @@ -389,33 +648,23 @@ def _update_initial( 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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(app_resource, 'AppResource') - # 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') + request = build_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + content_type=content_type, + json=_json, + template_url=self._update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -433,8 +682,11 @@ def _update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}'} # type: ignore + + @distributed_trace def begin_update( self, resource_group_name, # type: str @@ -457,15 +709,20 @@ def begin_update( :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. + :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: + :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 """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.AppResource"] lro_delay = kwargs.pop( 'polling_interval', @@ -478,28 +735,21 @@ def begin_update( service_name=service_name, app_name=app_name, app_resource=app_resource, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_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 = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -511,8 +761,10 @@ def get_long_running_output(pipeline_response): ) 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 + @distributed_trace def list( self, resource_group_name, # type: str @@ -528,8 +780,10 @@ def list( :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.paging.ItemPaged[~azure.mgmt.appplatform.v2021_06_01_preview.models.AppResourceCollection] + :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"] @@ -537,36 +791,33 @@ def list( 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) + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('AppResourceCollection', pipeline_response) + deserialized = self._deserialize("AppResourceCollection", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -584,11 +835,13 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps'} # type: ignore + @distributed_trace def get_resource_upload_url( self, resource_group_name, # type: str @@ -616,28 +869,18 @@ def get_resource_upload_url( 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 = build_get_resource_upload_url_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + template_url=self.get_resource_upload_url.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -651,8 +894,11 @@ def get_resource_upload_url( 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 + + @distributed_trace def validate_domain( self, resource_group_name, # type: str @@ -672,7 +918,8 @@ def validate_domain( :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 + :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 @@ -683,33 +930,23 @@ def validate_domain( 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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(validate_payload, 'CustomDomainValidatePayload') - # 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') + request = build_validate_domain_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + content_type=content_type, + json=_json, + template_url=self.validate_domain.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -723,4 +960,6 @@ def validate_domain( 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/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2021_06_01_preview/operations/_bindings_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2021_06_01_preview/operations/_bindings_operations.py index 055f8f16cc171..12e3d47d81fec 100644 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2021_06_01_preview/operations/_bindings_operations.py +++ b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2021_06_01_preview/operations/_bindings_operations.py @@ -5,26 +5,240 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools from typing import TYPE_CHECKING import warnings 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.pipeline.transport import HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling +from msrest import Serializer from .. import models as _models +from .._vendor import _convert_request, _format_url_section 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]] +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False +# fmt: off + +def build_get_request( + subscription_id, # type: str + resource_group_name, # type: str + service_name, # type: str + app_name, # type: str + binding_name, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + api_version = "2021-06-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/bindings/{bindingName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), + "appName": _SERIALIZER.url("app_name", app_name, 'str'), + "bindingName": _SERIALIZER.url("binding_name", binding_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_create_or_update_request_initial( + subscription_id, # type: str + resource_group_name, # type: str + service_name, # type: str + app_name, # type: str + binding_name, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2021-06-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/bindings/{bindingName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), + "appName": _SERIALIZER.url("app_name", app_name, 'str'), + "bindingName": _SERIALIZER.url("binding_name", binding_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_delete_request_initial( + subscription_id, # type: str + resource_group_name, # type: str + service_name, # type: str + app_name, # type: str + binding_name, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + api_version = "2021-06-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/bindings/{bindingName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), + "appName": _SERIALIZER.url("app_name", app_name, 'str'), + "bindingName": _SERIALIZER.url("binding_name", binding_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="DELETE", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_update_request_initial( + subscription_id, # type: str + resource_group_name, # type: str + service_name, # type: str + app_name, # type: str + binding_name, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2021-06-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/bindings/{bindingName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), + "appName": _SERIALIZER.url("app_name", app_name, 'str'), + "bindingName": _SERIALIZER.url("binding_name", binding_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PATCH", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_list_request( + subscription_id, # type: str + resource_group_name, # type: str + service_name, # type: str + app_name, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + api_version = "2021-06-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/bindings') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), + "appName": _SERIALIZER.url("app_name", app_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + +# fmt: on class BindingsOperations(object): """BindingsOperations operations. @@ -47,6 +261,7 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def get( self, resource_group_name, # type: str @@ -77,29 +292,19 @@ def get( 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 = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + binding_name=binding_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -113,8 +318,10 @@ def get( 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 + def _create_or_update_initial( self, resource_group_name, # type: str @@ -130,34 +337,24 @@ def _create_or_update_initial( 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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = self._serialize.body(binding_resource, 'BindingResource') + + request = build_create_or_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + binding_name=binding_name, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -178,8 +375,11 @@ def _create_or_update_initial( 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 + + @distributed_trace def begin_create_or_update( self, resource_group_name, # type: str @@ -205,15 +405,20 @@ def begin_create_or_update( :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. + :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: + :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 """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.BindingResource"] lro_delay = kwargs.pop( 'polling_interval', @@ -227,29 +432,21 @@ def begin_create_or_update( app_name=app_name, binding_name=binding_name, binding_resource=binding_resource, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_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 = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -261,6 +458,7 @@ def get_long_running_output(pipeline_response): ) 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( @@ -277,29 +475,19 @@ def _delete_initial( 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 = build_delete_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + binding_name=binding_name, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -312,6 +500,8 @@ def _delete_initial( _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/bindings/{bindingName}'} # type: ignore + + @distributed_trace def begin_delete( self, resource_group_name, # type: str @@ -334,15 +524,17 @@ def begin_delete( :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 ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :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. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -358,23 +550,14 @@ def begin_delete( 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 = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -386,6 +569,7 @@ def get_long_running_output(pipeline_response): ) 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( @@ -403,34 +587,24 @@ def _update_initial( 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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(binding_resource, 'BindingResource') - # 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') + request = build_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + binding_name=binding_name, + content_type=content_type, + json=_json, + template_url=self._update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -448,8 +622,11 @@ def _update_initial( 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 + + @distributed_trace def begin_update( self, resource_group_name, # type: str @@ -475,15 +652,20 @@ def begin_update( :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. + :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: + :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 """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.BindingResource"] lro_delay = kwargs.pop( 'polling_interval', @@ -497,29 +679,21 @@ def begin_update( app_name=app_name, binding_name=binding_name, binding_resource=binding_resource, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_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 = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -531,8 +705,10 @@ def get_long_running_output(pipeline_response): ) 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 + @distributed_trace def list( self, resource_group_name, # type: str @@ -551,8 +727,10 @@ def list( :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.paging.ItemPaged[~azure.mgmt.appplatform.v2021_06_01_preview.models.BindingResourceCollection] + :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"] @@ -560,37 +738,35 @@ def list( 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) + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('BindingResourceCollection', pipeline_response) + deserialized = self._deserialize("BindingResourceCollection", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -608,6 +784,7 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2021_06_01_preview/operations/_certificates_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2021_06_01_preview/operations/_certificates_operations.py index 51ba407eef86b..a1c8b3f808f7f 100644 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2021_06_01_preview/operations/_certificates_operations.py +++ b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2021_06_01_preview/operations/_certificates_operations.py @@ -5,26 +5,188 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools from typing import TYPE_CHECKING import warnings 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.pipeline.transport import HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling +from msrest import Serializer from .. import models as _models +from .._vendor import _convert_request, _format_url_section 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]] +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False +# fmt: off + +def build_get_request( + subscription_id, # type: str + resource_group_name, # type: str + service_name, # type: str + certificate_name, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + api_version = "2021-06-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/certificates/{certificateName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), + "certificateName": _SERIALIZER.url("certificate_name", certificate_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_create_or_update_request_initial( + subscription_id, # type: str + resource_group_name, # type: str + service_name, # type: str + certificate_name, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2021-06-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/certificates/{certificateName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), + "certificateName": _SERIALIZER.url("certificate_name", certificate_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_delete_request_initial( + subscription_id, # type: str + resource_group_name, # type: str + service_name, # type: str + certificate_name, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + api_version = "2021-06-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/certificates/{certificateName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), + "certificateName": _SERIALIZER.url("certificate_name", certificate_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="DELETE", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_list_request( + subscription_id, # type: str + resource_group_name, # type: str + service_name, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + api_version = "2021-06-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/certificates') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + +# fmt: on class CertificatesOperations(object): """CertificatesOperations operations. @@ -47,6 +209,7 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def get( self, resource_group_name, # type: str @@ -74,28 +237,18 @@ def get( 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 = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + certificate_name=certificate_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -109,8 +262,10 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized + 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, # type: str @@ -125,33 +280,23 @@ def _create_or_update_initial( 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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = self._serialize.body(certificate_resource, 'CertificateResource') + + request = build_create_or_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + certificate_name=certificate_name, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -172,8 +317,11 @@ def _create_or_update_initial( 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 + + @distributed_trace def begin_create_or_update( self, resource_group_name, # type: str @@ -193,18 +341,24 @@ def begin_create_or_update( :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 + :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. + :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: + :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 """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.CertificateResource"] lro_delay = kwargs.pop( 'polling_interval', @@ -217,28 +371,21 @@ def begin_create_or_update( service_name=service_name, certificate_name=certificate_name, certificate_resource=certificate_resource, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_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 = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -250,6 +397,7 @@ def get_long_running_output(pipeline_response): ) 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( @@ -265,28 +413,18 @@ def _delete_initial( 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 = build_delete_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + certificate_name=certificate_name, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -299,6 +437,8 @@ def _delete_initial( _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/certificates/{certificateName}'} # type: ignore + + @distributed_trace def begin_delete( self, resource_group_name, # type: str @@ -318,15 +458,17 @@ def begin_delete( :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 ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :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. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -341,22 +483,14 @@ def begin_delete( 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 = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -368,8 +502,10 @@ def get_long_running_output(pipeline_response): ) 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 + @distributed_trace def list( self, resource_group_name, # type: str @@ -385,8 +521,10 @@ def list( :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.paging.ItemPaged[~azure.mgmt.appplatform.v2021_06_01_preview.models.CertificateResourceCollection] + :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"] @@ -394,36 +532,33 @@ def list( 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) + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('CertificateResourceCollection', pipeline_response) + deserialized = self._deserialize("CertificateResourceCollection", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -441,6 +576,7 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2021_06_01_preview/operations/_config_servers_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2021_06_01_preview/operations/_config_servers_operations.py index aba3e06c24d4f..3c298afd4edc0 100644 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2021_06_01_preview/operations/_config_servers_operations.py +++ b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2021_06_01_preview/operations/_config_servers_operations.py @@ -5,25 +5,189 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools from typing import TYPE_CHECKING 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 HttpRequest, HttpResponse +from azure.core.pipeline.transport import HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling +from msrest import Serializer from .. import models as _models +from .._vendor import _convert_request, _format_url_section 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]] +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False +# fmt: off + +def build_get_request( + subscription_id, # type: str + resource_group_name, # type: str + service_name, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + api_version = "2021-06-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configServers/default') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_update_put_request_initial( + subscription_id, # type: str + resource_group_name, # type: str + service_name, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2021-06-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configServers/default') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_update_patch_request_initial( + subscription_id, # type: str + resource_group_name, # type: str + service_name, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2021-06-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configServers/default') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PATCH", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_validate_request_initial( + subscription_id, # type: str + resource_group_name, # type: str + service_name, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2021-06-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configServers/validate') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + +# fmt: on class ConfigServersOperations(object): """ConfigServersOperations operations. @@ -46,6 +210,7 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def get( self, resource_group_name, # type: str @@ -70,27 +235,17 @@ def get( 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 = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -104,8 +259,10 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configServers/default'} # type: ignore + def _update_put_initial( self, resource_group_name, # type: str @@ -119,32 +276,22 @@ def _update_put_initial( 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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = self._serialize.body(config_server_resource, 'ConfigServerResource') + + request = build_update_put_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + content_type=content_type, + json=_json, + template_url=self._update_put_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -162,8 +309,11 @@ def _update_put_initial( 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 + + @distributed_trace def begin_update_put( self, resource_group_name, # type: str @@ -180,18 +330,24 @@ def begin_update_put( :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 + :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. + :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: + :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 """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.ConfigServerResource"] lro_delay = kwargs.pop( 'polling_interval', @@ -203,27 +359,21 @@ def begin_update_put( resource_group_name=resource_group_name, service_name=service_name, config_server_resource=config_server_resource, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_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 = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -235,6 +385,7 @@ def get_long_running_output(pipeline_response): ) 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( @@ -250,32 +401,22 @@ def _update_patch_initial( 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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(config_server_resource, 'ConfigServerResource') - # 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') + request = build_update_patch_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + content_type=content_type, + json=_json, + template_url=self._update_patch_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -293,8 +434,11 @@ def _update_patch_initial( 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 + + @distributed_trace def begin_update_patch( self, resource_group_name, # type: str @@ -311,18 +455,24 @@ def begin_update_patch( :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 + :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. + :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: + :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 """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.ConfigServerResource"] lro_delay = kwargs.pop( 'polling_interval', @@ -334,27 +484,21 @@ def begin_update_patch( resource_group_name=resource_group_name, service_name=service_name, config_server_resource=config_server_resource, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_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 = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -366,6 +510,7 @@ def get_long_running_output(pipeline_response): ) 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( @@ -381,32 +526,22 @@ def _validate_initial( 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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = self._serialize.body(config_server_settings, 'ConfigServerSettings') + + request = build_validate_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + content_type=content_type, + json=_json, + template_url=self._validate_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -424,8 +559,11 @@ def _validate_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _validate_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configServers/validate'} # type: ignore + + @distributed_trace def begin_validate( self, resource_group_name, # type: str @@ -442,18 +580,24 @@ def begin_validate( :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 + :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. + :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: + :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 """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.ConfigServerSettingsValidateResult"] lro_delay = kwargs.pop( 'polling_interval', @@ -465,27 +609,21 @@ def begin_validate( resource_group_name=resource_group_name, service_name=service_name, config_server_settings=config_server_settings, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_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 = ARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -497,4 +635,5 @@ def get_long_running_output(pipeline_response): ) 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/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2021_06_01_preview/operations/_custom_domains_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2021_06_01_preview/operations/_custom_domains_operations.py index e7e4cafb94e01..7783fc37401ab 100644 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2021_06_01_preview/operations/_custom_domains_operations.py +++ b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2021_06_01_preview/operations/_custom_domains_operations.py @@ -5,26 +5,240 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools from typing import TYPE_CHECKING import warnings 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.pipeline.transport import HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling +from msrest import Serializer from .. import models as _models +from .._vendor import _convert_request, _format_url_section 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]] +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False +# fmt: off + +def build_get_request( + subscription_id, # type: str + resource_group_name, # type: str + service_name, # type: str + app_name, # type: str + domain_name, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + api_version = "2021-06-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/domains/{domainName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), + "appName": _SERIALIZER.url("app_name", app_name, 'str'), + "domainName": _SERIALIZER.url("domain_name", domain_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_create_or_update_request_initial( + subscription_id, # type: str + resource_group_name, # type: str + service_name, # type: str + app_name, # type: str + domain_name, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2021-06-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/domains/{domainName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), + "appName": _SERIALIZER.url("app_name", app_name, 'str'), + "domainName": _SERIALIZER.url("domain_name", domain_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_delete_request_initial( + subscription_id, # type: str + resource_group_name, # type: str + service_name, # type: str + app_name, # type: str + domain_name, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + api_version = "2021-06-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/domains/{domainName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), + "appName": _SERIALIZER.url("app_name", app_name, 'str'), + "domainName": _SERIALIZER.url("domain_name", domain_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="DELETE", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_update_request_initial( + subscription_id, # type: str + resource_group_name, # type: str + service_name, # type: str + app_name, # type: str + domain_name, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2021-06-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/domains/{domainName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), + "appName": _SERIALIZER.url("app_name", app_name, 'str'), + "domainName": _SERIALIZER.url("domain_name", domain_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PATCH", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_list_request( + subscription_id, # type: str + resource_group_name, # type: str + service_name, # type: str + app_name, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + api_version = "2021-06-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/domains') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), + "appName": _SERIALIZER.url("app_name", app_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + +# fmt: on class CustomDomainsOperations(object): """CustomDomainsOperations operations. @@ -47,6 +261,7 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def get( self, resource_group_name, # type: str @@ -77,29 +292,19 @@ def get( 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 = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + domain_name=domain_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -113,8 +318,10 @@ def get( 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 + def _create_or_update_initial( self, resource_group_name, # type: str @@ -130,34 +337,24 @@ def _create_or_update_initial( 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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = self._serialize.body(domain_resource, 'CustomDomainResource') + + request = build_create_or_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + domain_name=domain_name, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -178,8 +375,11 @@ def _create_or_update_initial( 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 + + @distributed_trace def begin_create_or_update( self, resource_group_name, # type: str @@ -205,15 +405,20 @@ def begin_create_or_update( :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. + :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: + :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 """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.CustomDomainResource"] lro_delay = kwargs.pop( 'polling_interval', @@ -227,29 +432,21 @@ def begin_create_or_update( app_name=app_name, domain_name=domain_name, domain_resource=domain_resource, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_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 = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -261,6 +458,7 @@ def get_long_running_output(pipeline_response): ) 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( @@ -277,29 +475,19 @@ def _delete_initial( 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 = build_delete_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + domain_name=domain_name, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -312,6 +500,8 @@ def _delete_initial( _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/domains/{domainName}'} # type: ignore + + @distributed_trace def begin_delete( self, resource_group_name, # type: str @@ -334,15 +524,17 @@ def begin_delete( :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 ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :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. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -358,23 +550,14 @@ def begin_delete( 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 = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -386,6 +569,7 @@ def get_long_running_output(pipeline_response): ) 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( @@ -403,34 +587,24 @@ def _update_initial( 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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(domain_resource, 'CustomDomainResource') - # 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') + request = build_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + domain_name=domain_name, + content_type=content_type, + json=_json, + template_url=self._update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -448,8 +622,11 @@ def _update_initial( 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 + + @distributed_trace def begin_update( self, resource_group_name, # type: str @@ -475,15 +652,20 @@ def begin_update( :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. + :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: + :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 """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.CustomDomainResource"] lro_delay = kwargs.pop( 'polling_interval', @@ -497,29 +679,21 @@ def begin_update( app_name=app_name, domain_name=domain_name, domain_resource=domain_resource, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_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 = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -531,8 +705,10 @@ def get_long_running_output(pipeline_response): ) 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 + @distributed_trace def list( self, resource_group_name, # type: str @@ -551,8 +727,10 @@ def list( :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.paging.ItemPaged[~azure.mgmt.appplatform.v2021_06_01_preview.models.CustomDomainResourceCollection] + :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"] @@ -560,37 +738,35 @@ def list( 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) + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('CustomDomainResourceCollection', pipeline_response) + deserialized = self._deserialize("CustomDomainResourceCollection", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -608,6 +784,7 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2021_06_01_preview/operations/_deployments_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2021_06_01_preview/operations/_deployments_operations.py index 0c1fe5d247f03..2962603a54d8e 100644 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2021_06_01_preview/operations/_deployments_operations.py +++ b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2021_06_01_preview/operations/_deployments_operations.py @@ -5,26 +5,444 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools from typing import TYPE_CHECKING import warnings 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.pipeline.transport import HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling +from msrest import Serializer from .. import models as _models +from .._vendor import _convert_request, _format_url_section 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]] +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False +# fmt: off + +def build_get_request( + subscription_id, # type: str + resource_group_name, # type: str + service_name, # type: str + app_name, # type: str + deployment_name, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + api_version = "2021-06-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), + "appName": _SERIALIZER.url("app_name", app_name, 'str'), + "deploymentName": _SERIALIZER.url("deployment_name", deployment_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_create_or_update_request_initial( + subscription_id, # type: str + resource_group_name, # type: str + service_name, # type: str + app_name, # type: str + deployment_name, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2021-06-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), + "appName": _SERIALIZER.url("app_name", app_name, 'str'), + "deploymentName": _SERIALIZER.url("deployment_name", deployment_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_delete_request_initial( + subscription_id, # type: str + resource_group_name, # type: str + service_name, # type: str + app_name, # type: str + deployment_name, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + api_version = "2021-06-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), + "appName": _SERIALIZER.url("app_name", app_name, 'str'), + "deploymentName": _SERIALIZER.url("deployment_name", deployment_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="DELETE", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_update_request_initial( + subscription_id, # type: str + resource_group_name, # type: str + service_name, # type: str + app_name, # type: str + deployment_name, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2021-06-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), + "appName": _SERIALIZER.url("app_name", app_name, 'str'), + "deploymentName": _SERIALIZER.url("deployment_name", deployment_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PATCH", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_list_request( + subscription_id, # type: str + resource_group_name, # type: str + service_name, # type: str + app_name, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + version = kwargs.pop('version', None) # type: Optional[List[str]] + + api_version = "2021-06-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), + "appName": _SERIALIZER.url("app_name", app_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + if version is not None: + query_parameters['version'] = [_SERIALIZER.query("version", q, 'str') if q is not None else '' for q in version] + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_list_for_cluster_request( + subscription_id, # type: str + resource_group_name, # type: str + service_name, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + version = kwargs.pop('version', None) # type: Optional[List[str]] + + api_version = "2021-06-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/deployments') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + if version is not None: + query_parameters['version'] = [_SERIALIZER.query("version", q, 'str') if q is not None else '' for q in version] + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_start_request_initial( + subscription_id, # type: str + resource_group_name, # type: str + service_name, # type: str + app_name, # type: str + deployment_name, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + api_version = "2021-06-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/start') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), + "appName": _SERIALIZER.url("app_name", app_name, 'str'), + "deploymentName": _SERIALIZER.url("deployment_name", deployment_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_stop_request_initial( + subscription_id, # type: str + resource_group_name, # type: str + service_name, # type: str + app_name, # type: str + deployment_name, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + api_version = "2021-06-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/stop') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), + "appName": _SERIALIZER.url("app_name", app_name, 'str'), + "deploymentName": _SERIALIZER.url("deployment_name", deployment_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_restart_request_initial( + subscription_id, # type: str + resource_group_name, # type: str + service_name, # type: str + app_name, # type: str + deployment_name, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + api_version = "2021-06-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/restart') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), + "appName": _SERIALIZER.url("app_name", app_name, 'str'), + "deploymentName": _SERIALIZER.url("deployment_name", deployment_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_get_log_file_url_request( + subscription_id, # type: str + resource_group_name, # type: str + service_name, # type: str + app_name, # type: str + deployment_name, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + api_version = "2021-06-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/getLogFileUrl') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), + "appName": _SERIALIZER.url("app_name", app_name, 'str'), + "deploymentName": _SERIALIZER.url("deployment_name", deployment_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + +# fmt: on class DeploymentsOperations(object): """DeploymentsOperations operations. @@ -47,6 +465,7 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def get( self, resource_group_name, # type: str @@ -77,29 +496,19 @@ def get( 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 = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + deployment_name=deployment_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -113,8 +522,10 @@ def get( 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 + def _create_or_update_initial( self, resource_group_name, # type: str @@ -130,34 +541,24 @@ def _create_or_update_initial( 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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = self._serialize.body(deployment_resource, 'DeploymentResource') + + request = build_create_or_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + deployment_name=deployment_name, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -178,8 +579,11 @@ def _create_or_update_initial( 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 + + @distributed_trace def begin_create_or_update( self, resource_group_name, # type: str @@ -202,18 +606,24 @@ def begin_create_or_update( :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 + :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. + :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: + :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 """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.DeploymentResource"] lro_delay = kwargs.pop( 'polling_interval', @@ -227,29 +637,21 @@ def begin_create_or_update( app_name=app_name, deployment_name=deployment_name, deployment_resource=deployment_resource, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_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 = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -261,6 +663,7 @@ def get_long_running_output(pipeline_response): ) 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( @@ -277,29 +680,19 @@ def _delete_initial( 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 = build_delete_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + deployment_name=deployment_name, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -312,6 +705,8 @@ def _delete_initial( _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}'} # type: ignore + + @distributed_trace def begin_delete( self, resource_group_name, # type: str @@ -334,15 +729,17 @@ def begin_delete( :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 ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :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. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -358,23 +755,14 @@ def begin_delete( 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 = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -386,6 +774,7 @@ def get_long_running_output(pipeline_response): ) 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( @@ -403,34 +792,24 @@ def _update_initial( 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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = self._serialize.body(deployment_resource, 'DeploymentResource') + + request = build_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + deployment_name=deployment_name, + content_type=content_type, + json=_json, + template_url=self._update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -448,8 +827,11 @@ def _update_initial( 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 + + @distributed_trace def begin_update( self, resource_group_name, # type: str @@ -472,18 +854,24 @@ def begin_update( :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 + :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. + :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: + :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 """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.DeploymentResource"] lro_delay = kwargs.pop( 'polling_interval', @@ -497,29 +885,21 @@ def begin_update( app_name=app_name, deployment_name=deployment_name, deployment_resource=deployment_resource, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_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 = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -531,8 +911,10 @@ def get_long_running_output(pipeline_response): ) 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 + @distributed_trace def list( self, resource_group_name, # type: str @@ -554,8 +936,10 @@ def list( :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.paging.ItemPaged[~azure.mgmt.appplatform.v2021_06_01_preview.models.DeploymentResourceCollection] + :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"] @@ -563,39 +947,37 @@ def list( 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) + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + version=version, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + version=version, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('DeploymentResourceCollection', pipeline_response) + deserialized = self._deserialize("DeploymentResourceCollection", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -613,11 +995,13 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments'} # type: ignore + @distributed_trace def list_for_cluster( self, resource_group_name, # type: str @@ -636,8 +1020,10 @@ def list_for_cluster( :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.paging.ItemPaged[~azure.mgmt.appplatform.v2021_06_01_preview.models.DeploymentResourceCollection] + :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"] @@ -645,38 +1031,35 @@ def list_for_cluster( 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) + + request = build_list_for_cluster_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + version=version, + template_url=self.list_for_cluster.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_for_cluster_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + version=version, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('DeploymentResourceCollection', pipeline_response) + deserialized = self._deserialize("DeploymentResourceCollection", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -694,6 +1077,7 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) @@ -713,29 +1097,19 @@ def _start_initial( 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 = build_start_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + deployment_name=deployment_name, + template_url=self._start_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -748,6 +1122,8 @@ def _start_initial( _start_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/start'} # type: ignore + + @distributed_trace def begin_start( self, resource_group_name, # type: str @@ -770,15 +1146,17 @@ def begin_start( :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 ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :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. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -794,23 +1172,14 @@ def begin_start( 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 = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -822,6 +1191,7 @@ def get_long_running_output(pipeline_response): ) 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( @@ -838,29 +1208,19 @@ def _stop_initial( 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 = build_stop_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + deployment_name=deployment_name, + template_url=self._stop_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -873,6 +1233,8 @@ def _stop_initial( _stop_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/stop'} # type: ignore + + @distributed_trace def begin_stop( self, resource_group_name, # type: str @@ -895,15 +1257,17 @@ def begin_stop( :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 ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :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. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -919,23 +1283,14 @@ def begin_stop( 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 = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -947,6 +1302,7 @@ def get_long_running_output(pipeline_response): ) 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( @@ -963,29 +1319,19 @@ def _restart_initial( 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 = build_restart_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + deployment_name=deployment_name, + template_url=self._restart_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -998,6 +1344,8 @@ def _restart_initial( _restart_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/restart'} # type: ignore + + @distributed_trace def begin_restart( self, resource_group_name, # type: str @@ -1020,15 +1368,17 @@ def begin_restart( :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 ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :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. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -1044,23 +1394,14 @@ def begin_restart( 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 = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -1072,8 +1413,10 @@ def get_long_running_output(pipeline_response): ) 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 + @distributed_trace def get_log_file_url( self, resource_group_name, # type: str @@ -1104,29 +1447,19 @@ def get_log_file_url( 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 = build_get_log_file_url_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + deployment_name=deployment_name, + template_url=self.get_log_file_url.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -1142,4 +1475,6 @@ def get_log_file_url( 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/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2021_06_01_preview/operations/_monitoring_settings_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2021_06_01_preview/operations/_monitoring_settings_operations.py index 4b278909b72aa..b58fd732aa671 100644 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2021_06_01_preview/operations/_monitoring_settings_operations.py +++ b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2021_06_01_preview/operations/_monitoring_settings_operations.py @@ -5,25 +5,149 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools from typing import TYPE_CHECKING 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 HttpRequest, HttpResponse +from azure.core.pipeline.transport import HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling +from msrest import Serializer from .. import models as _models +from .._vendor import _convert_request, _format_url_section 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]] +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False +# fmt: off + +def build_get_request( + subscription_id, # type: str + resource_group_name, # type: str + service_name, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + api_version = "2021-06-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/monitoringSettings/default') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_update_put_request_initial( + subscription_id, # type: str + resource_group_name, # type: str + service_name, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2021-06-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/monitoringSettings/default') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_update_patch_request_initial( + subscription_id, # type: str + resource_group_name, # type: str + service_name, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2021-06-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/monitoringSettings/default') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PATCH", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + +# fmt: on class MonitoringSettingsOperations(object): """MonitoringSettingsOperations operations. @@ -46,6 +170,7 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def get( self, resource_group_name, # type: str @@ -70,27 +195,17 @@ def get( 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 = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -104,8 +219,10 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/monitoringSettings/default'} # type: ignore + def _update_put_initial( self, resource_group_name, # type: str @@ -119,32 +236,22 @@ def _update_put_initial( 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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = self._serialize.body(monitoring_setting_resource, 'MonitoringSettingResource') + + request = build_update_put_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + content_type=content_type, + json=_json, + template_url=self._update_put_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -162,8 +269,11 @@ def _update_put_initial( 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 + + @distributed_trace def begin_update_put( self, resource_group_name, # type: str @@ -180,18 +290,24 @@ def begin_update_put( :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 + :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. + :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: + :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 """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.MonitoringSettingResource"] lro_delay = kwargs.pop( 'polling_interval', @@ -203,27 +319,21 @@ def begin_update_put( resource_group_name=resource_group_name, service_name=service_name, monitoring_setting_resource=monitoring_setting_resource, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_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 = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -235,6 +345,7 @@ def get_long_running_output(pipeline_response): ) 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( @@ -250,32 +361,22 @@ def _update_patch_initial( 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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = self._serialize.body(monitoring_setting_resource, 'MonitoringSettingResource') + + request = build_update_patch_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + content_type=content_type, + json=_json, + template_url=self._update_patch_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -293,8 +394,11 @@ def _update_patch_initial( 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 + + @distributed_trace def begin_update_patch( self, resource_group_name, # type: str @@ -311,18 +415,24 @@ def begin_update_patch( :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 + :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. + :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: + :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 """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.MonitoringSettingResource"] lro_delay = kwargs.pop( 'polling_interval', @@ -334,27 +444,21 @@ def begin_update_patch( resource_group_name=resource_group_name, service_name=service_name, monitoring_setting_resource=monitoring_setting_resource, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_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 = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -366,4 +470,5 @@ def get_long_running_output(pipeline_response): ) 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/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2021_06_01_preview/operations/_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2021_06_01_preview/operations/_operations.py index 3a411f52957b1..10a6b7bcfaafc 100644 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2021_06_01_preview/operations/_operations.py +++ b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2021_06_01_preview/operations/_operations.py @@ -5,24 +5,58 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools from typing import TYPE_CHECKING import warnings 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.pipeline.transport import HttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat +from msrest import Serializer from .. import models as _models +from .._vendor import _convert_request 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]] +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False +# fmt: off + +def build_list_request( + **kwargs # type: Any +): + # type: (...) -> HttpRequest + api_version = "2021-06-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/providers/Microsoft.AppPlatform/operations') + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + +# fmt: on class Operations(object): """Operations operations. @@ -45,6 +79,7 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def list( self, **kwargs # type: Any @@ -54,7 +89,8 @@ def list( :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] + :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"] @@ -62,30 +98,27 @@ def list( 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 = build_list_request( + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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) + + request = build_list_request( + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('AvailableOperations', pipeline_response) + deserialized = self._deserialize("AvailableOperations", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -103,6 +136,7 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2021_06_01_preview/operations/_runtime_versions_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2021_06_01_preview/operations/_runtime_versions_operations.py index 26067aebd4fb7..48067e36fa66f 100644 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2021_06_01_preview/operations/_runtime_versions_operations.py +++ b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2021_06_01_preview/operations/_runtime_versions_operations.py @@ -5,23 +5,57 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools from typing import TYPE_CHECKING 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 HttpRequest, HttpResponse +from azure.core.pipeline.transport import HttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat +from msrest import Serializer from .. import models as _models +from .._vendor import _convert_request 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]] +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False +# fmt: off + +def build_list_runtime_versions_request( + **kwargs # type: Any +): + # type: (...) -> HttpRequest + api_version = "2021-06-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/providers/Microsoft.AppPlatform/runtimeVersions') + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + +# fmt: on class RuntimeVersionsOperations(object): """RuntimeVersionsOperations operations. @@ -44,6 +78,7 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def list_runtime_versions( self, **kwargs # type: Any @@ -61,21 +96,14 @@ def list_runtime_versions( 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 = build_list_runtime_versions_request( + template_url=self.list_runtime_versions.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -89,4 +117,6 @@ def list_runtime_versions( return cls(pipeline_response, deserialized, {}) return deserialized + list_runtime_versions.metadata = {'url': '/providers/Microsoft.AppPlatform/runtimeVersions'} # type: ignore + diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2021_06_01_preview/operations/_services_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2021_06_01_preview/operations/_services_operations.py index ec19c6b6bc10b..a466b511f7234 100644 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2021_06_01_preview/operations/_services_operations.py +++ b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2021_06_01_preview/operations/_services_operations.py @@ -5,26 +5,438 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools from typing import TYPE_CHECKING import warnings 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.pipeline.transport import HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling +from msrest import Serializer from .. import models as _models +from .._vendor import _convert_request, _format_url_section 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]] +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False +# fmt: off + +def build_get_request( + subscription_id, # type: str + resource_group_name, # type: str + service_name, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + api_version = "2021-06-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_create_or_update_request_initial( + subscription_id, # type: str + resource_group_name, # type: str + service_name, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2021-06-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_delete_request_initial( + subscription_id, # type: str + resource_group_name, # type: str + service_name, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + api_version = "2021-06-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="DELETE", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_update_request_initial( + subscription_id, # type: str + resource_group_name, # type: str + service_name, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2021-06-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PATCH", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_list_test_keys_request( + subscription_id, # type: str + resource_group_name, # type: str + service_name, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + api_version = "2021-06-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/listTestKeys') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_regenerate_test_key_request( + subscription_id, # type: str + resource_group_name, # type: str + service_name, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2021-06-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/regenerateTestKey') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_disable_test_endpoint_request( + subscription_id, # type: str + resource_group_name, # type: str + service_name, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + api_version = "2021-06-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/disableTestEndpoint') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_enable_test_endpoint_request( + subscription_id, # type: str + resource_group_name, # type: str + service_name, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + api_version = "2021-06-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/enableTestEndpoint') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_check_name_availability_request( + subscription_id, # type: str + location, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2021-06-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.AppPlatform/locations/{location}/checkNameAvailability') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "location": _SERIALIZER.url("location", location, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_list_by_subscription_request( + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + api_version = "2021-06-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.AppPlatform/Spring') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_list_request( + subscription_id, # type: str + resource_group_name, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + api_version = "2021-06-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + +# fmt: on class ServicesOperations(object): """ServicesOperations operations. @@ -47,6 +459,7 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def get( self, resource_group_name, # type: str @@ -71,27 +484,17 @@ def get( 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 = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -105,8 +508,10 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}'} # type: ignore + def _create_or_update_initial( self, resource_group_name, # type: str @@ -120,32 +525,22 @@ def _create_or_update_initial( 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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = self._serialize.body(resource, 'ServiceResource') + + request = build_create_or_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -166,8 +561,11 @@ def _create_or_update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}'} # type: ignore + + @distributed_trace def begin_create_or_update( self, resource_group_name, # type: str @@ -187,15 +585,20 @@ def begin_create_or_update( :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. + :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: + :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 """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.ServiceResource"] lro_delay = kwargs.pop( 'polling_interval', @@ -207,27 +610,21 @@ def begin_create_or_update( resource_group_name=resource_group_name, service_name=service_name, resource=resource, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_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 = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -239,6 +636,7 @@ def get_long_running_output(pipeline_response): ) 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( @@ -253,27 +651,17 @@ def _delete_initial( 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 = build_delete_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -286,6 +674,8 @@ def _delete_initial( _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}'} # type: ignore + + @distributed_trace def begin_delete( self, resource_group_name, # type: str @@ -302,15 +692,17 @@ def begin_delete( :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 ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :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. + :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -324,21 +716,14 @@ def begin_delete( 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 = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -350,6 +735,7 @@ def get_long_running_output(pipeline_response): ) 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( @@ -365,32 +751,22 @@ def _update_initial( 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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = self._serialize.body(resource, 'ServiceResource') + + request = build_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + content_type=content_type, + json=_json, + template_url=self._update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -408,8 +784,11 @@ def _update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}'} # type: ignore + + @distributed_trace def begin_update( self, resource_group_name, # type: str @@ -429,15 +808,20 @@ def begin_update( :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. + :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: + :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 """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.ServiceResource"] lro_delay = kwargs.pop( 'polling_interval', @@ -449,27 +833,21 @@ def begin_update( resource_group_name=resource_group_name, service_name=service_name, resource=resource, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_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 = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -481,8 +859,10 @@ def get_long_running_output(pipeline_response): ) 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 + @distributed_trace def list_test_keys( self, resource_group_name, # type: str @@ -507,27 +887,17 @@ def list_test_keys( 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 = build_list_test_keys_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + template_url=self.list_test_keys.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -541,8 +911,11 @@ def list_test_keys( return cls(pipeline_response, deserialized, {}) return deserialized + list_test_keys.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/listTestKeys'} # type: ignore + + @distributed_trace def regenerate_test_key( self, resource_group_name, # type: str @@ -559,7 +932,8 @@ def regenerate_test_key( :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 + :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 @@ -570,32 +944,22 @@ def regenerate_test_key( 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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = self._serialize.body(regenerate_test_key_request, 'RegenerateTestKeyRequestPayload') + + request = build_regenerate_test_key_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + content_type=content_type, + json=_json, + template_url=self.regenerate_test_key.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -609,8 +973,11 @@ def regenerate_test_key( return cls(pipeline_response, deserialized, {}) return deserialized + regenerate_test_key.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/regenerateTestKey'} # type: ignore + + @distributed_trace def disable_test_endpoint( self, resource_group_name, # type: str @@ -635,27 +1002,17 @@ def disable_test_endpoint( 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 = build_disable_test_endpoint_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + template_url=self.disable_test_endpoint.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -668,6 +1025,8 @@ def disable_test_endpoint( disable_test_endpoint.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/disableTestEndpoint'} # type: ignore + + @distributed_trace def enable_test_endpoint( self, resource_group_name, # type: str @@ -692,27 +1051,17 @@ def enable_test_endpoint( 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 = build_enable_test_endpoint_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + template_url=self.enable_test_endpoint.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -726,8 +1075,11 @@ def enable_test_endpoint( return cls(pipeline_response, deserialized, {}) return deserialized + enable_test_endpoint.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/enableTestEndpoint'} # type: ignore + + @distributed_trace def check_name_availability( self, location, # type: str @@ -740,7 +1092,8 @@ def check_name_availability( :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 + :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 @@ -751,31 +1104,21 @@ def check_name_availability( 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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = self._serialize.body(availability_parameters, 'NameAvailabilityParameters') + + request = build_check_name_availability_request( + subscription_id=self._config.subscription_id, + location=location, + content_type=content_type, + json=_json, + template_url=self.check_name_availability.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -789,8 +1132,11 @@ def check_name_availability( return cls(pipeline_response, deserialized, {}) return deserialized + check_name_availability.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.AppPlatform/locations/{location}/checkNameAvailability'} # type: ignore + + @distributed_trace def list_by_subscription( self, **kwargs # type: Any @@ -800,7 +1146,8 @@ def list_by_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.paging.ItemPaged[~azure.mgmt.appplatform.v2021_06_01_preview.models.ServiceResourceList] + :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"] @@ -808,34 +1155,29 @@ def list_by_subscription( 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) + + request = build_list_by_subscription_request( + subscription_id=self._config.subscription_id, + template_url=self.list_by_subscription.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_subscription_request( + subscription_id=self._config.subscription_id, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('ServiceResourceList', pipeline_response) + deserialized = self._deserialize("ServiceResourceList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -853,11 +1195,13 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) list_by_subscription.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.AppPlatform/Spring'} # type: ignore + @distributed_trace def list( self, resource_group_name, # type: str @@ -871,7 +1215,8 @@ def list( :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.paging.ItemPaged[~azure.mgmt.appplatform.v2021_06_01_preview.models.ServiceResourceList] + :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"] @@ -879,35 +1224,31 @@ def list( 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) + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('ServiceResourceList', pipeline_response) + deserialized = self._deserialize("ServiceResourceList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -925,6 +1266,7 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2021_06_01_preview/operations/_skus_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2021_06_01_preview/operations/_skus_operations.py index 8ebe410203582..40a7d9701ec7c 100644 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2021_06_01_preview/operations/_skus_operations.py +++ b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2021_06_01_preview/operations/_skus_operations.py @@ -5,24 +5,64 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools from typing import TYPE_CHECKING import warnings 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.pipeline.transport import HttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat +from msrest import Serializer from .. import models as _models +from .._vendor import _convert_request, _format_url_section 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]] +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False +# fmt: off + +def build_list_request( + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + api_version = "2021-06-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.AppPlatform/skus') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + +# fmt: on class SkusOperations(object): """SkusOperations operations. @@ -45,6 +85,7 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def list( self, **kwargs # type: Any @@ -53,8 +94,10 @@ def list( """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.paging.ItemPaged[~azure.mgmt.appplatform.v2021_06_01_preview.models.ResourceSkuCollection] + :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"] @@ -62,34 +105,29 @@ def list( 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) + + request = build_list_request( + subscription_id=self._config.subscription_id, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('ResourceSkuCollection', pipeline_response) + deserialized = self._deserialize("ResourceSkuCollection", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -107,6 +145,7 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2021_09_01_preview/__init__.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2021_09_01_preview/__init__.py new file mode 100644 index 0000000000000..41ec6d71ff7fa --- /dev/null +++ b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2021_09_01_preview/__init__.py @@ -0,0 +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. +# 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 +from ._version import VERSION + +__version__ = VERSION +__all__ = ['AppPlatformManagementClient'] + +# `._patch.py` is used for handwritten extensions to the generated code +# Example: https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md +from ._patch import patch_sdk +patch_sdk() diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2021_09_01_preview/_app_platform_management_client.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2021_09_01_preview/_app_platform_management_client.py new file mode 100644 index 0000000000000..0c986823e8784 --- /dev/null +++ b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2021_09_01_preview/_app_platform_management_client.py @@ -0,0 +1,137 @@ +# 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 copy import deepcopy +from typing import TYPE_CHECKING + +from azure.mgmt.core import ARMPipelineClient +from msrest import Deserializer, Serializer + +from . import models +from ._configuration import AppPlatformManagementClientConfiguration +from .operations import AppsOperations, BindingsOperations, CertificatesOperations, ConfigServersOperations, CustomDomainsOperations, DeploymentsOperations, MonitoringSettingsOperations, Operations, RuntimeVersionsOperations, ServicesOperations, SkusOperations, StoragesOperations + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from typing import Any, Optional + + from azure.core.credentials import TokenCredential + from azure.core.rest import HttpRequest, HttpResponse + +class AppPlatformManagementClient(object): + """REST API for Azure Spring Cloud. + + :ivar services: ServicesOperations operations + :vartype services: azure.mgmt.appplatform.v2021_09_01_preview.operations.ServicesOperations + :ivar config_servers: ConfigServersOperations operations + :vartype config_servers: + azure.mgmt.appplatform.v2021_09_01_preview.operations.ConfigServersOperations + :ivar monitoring_settings: MonitoringSettingsOperations operations + :vartype monitoring_settings: + azure.mgmt.appplatform.v2021_09_01_preview.operations.MonitoringSettingsOperations + :ivar apps: AppsOperations operations + :vartype apps: azure.mgmt.appplatform.v2021_09_01_preview.operations.AppsOperations + :ivar bindings: BindingsOperations operations + :vartype bindings: azure.mgmt.appplatform.v2021_09_01_preview.operations.BindingsOperations + :ivar storages: StoragesOperations operations + :vartype storages: azure.mgmt.appplatform.v2021_09_01_preview.operations.StoragesOperations + :ivar certificates: CertificatesOperations operations + :vartype certificates: + azure.mgmt.appplatform.v2021_09_01_preview.operations.CertificatesOperations + :ivar custom_domains: CustomDomainsOperations operations + :vartype custom_domains: + azure.mgmt.appplatform.v2021_09_01_preview.operations.CustomDomainsOperations + :ivar deployments: DeploymentsOperations operations + :vartype deployments: + azure.mgmt.appplatform.v2021_09_01_preview.operations.DeploymentsOperations + :ivar operations: Operations operations + :vartype operations: azure.mgmt.appplatform.v2021_09_01_preview.operations.Operations + :ivar runtime_versions: RuntimeVersionsOperations operations + :vartype runtime_versions: + azure.mgmt.appplatform.v2021_09_01_preview.operations.RuntimeVersionsOperations + :ivar skus: SkusOperations operations + :vartype skus: azure.mgmt.appplatform.v2021_09_01_preview.operations.SkusOperations + :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 base_url: Service URL. Default value is 'https://management.azure.com'. + :type base_url: str + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + """ + + def __init__( + self, + credential, # type: "TokenCredential" + subscription_id, # type: str + base_url="https://management.azure.com", # type: str + **kwargs # type: Any + ): + # type: (...) -> None + self._config = AppPlatformManagementClientConfiguration(credential=credential, subscription_id=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._serialize = Serializer(client_models) + self._deserialize = Deserializer(client_models) + self._serialize.client_side_validation = False + 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.storages = StoragesOperations(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) + + + def _send_request( + self, + request, # type: HttpRequest + **kwargs # type: Any + ): + # type: (...) -> HttpResponse + """Runs the network request through the client's chained policies. + + >>> from azure.core.rest import HttpRequest + >>> request = HttpRequest("GET", "https://www.example.org/") + + >>> response = client._send_request(request) + + + For more information on this code flow, see https://aka.ms/azsdk/python/protocol/quickstart + + :param request: The network request you want to make. Required. + :type request: ~azure.core.rest.HttpRequest + :keyword bool stream: Whether the response payload will be streamed. Defaults to False. + :return: The response of your network call. Does not do error handling on your response. + :rtype: ~azure.core.rest.HttpResponse + """ + + request_copy = deepcopy(request) + request_copy.url = self._client.format_url(request_copy.url) + return self._client.send_request(request_copy, **kwargs) + + 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/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2021_09_01_preview/_configuration.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2021_09_01_preview/_configuration.py new file mode 100644 index 0000000000000..fe732fc119eec --- /dev/null +++ b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2021_09_01_preview/_configuration.py @@ -0,0 +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. +# 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 TYPE_CHECKING + +from azure.core.configuration import Configuration +from azure.core.pipeline import policies +from azure.mgmt.core.policies import ARMChallengeAuthenticationPolicy, 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. + + 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.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 + """ + + def __init__( + self, + credential, # type: "TokenCredential" + subscription_id, # type: str + **kwargs # type: Any + ): + # type: (...) -> None + super(AppPlatformManagementClientConfiguration, self).__init__(**kwargs) + 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.") + + self.credential = credential + self.subscription_id = subscription_id + self.api_version = "2021-09-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 = ARMChallengeAuthenticationPolicy(self.credential, *self.credential_scopes, **kwargs) diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2021_09_01_preview/_metadata.json b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2021_09_01_preview/_metadata.json new file mode 100644 index 0000000000000..ba96457c09dda --- /dev/null +++ b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2021_09_01_preview/_metadata.json @@ -0,0 +1,113 @@ +{ + "chosen_version": "2021-09-01-preview", + "total_api_version_list": ["2021-09-01-preview"], + "client": { + "name": "AppPlatformManagementClient", + "filename": "_app_platform_management_client", + "description": "REST API for Azure Spring Cloud.", + "host_value": "\"https://management.azure.com\"", + "parameterized_host_template": 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\"]}}}", + "async_imports": "{\"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"], \"azure.core.credentials\": [\"TokenCredential\"]}}, \"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\"]}}}" + }, + "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=\"https://management.azure.com\", # type: 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: str = \"https://management.azure.com\",", + "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_call_sync": "ARMChallengeAuthenticationPolicy(self.credential, *self.credential_scopes, **kwargs)", + "credential_call_async": "AsyncARMChallengeAuthenticationPolicy(self.credential, *self.credential_scopes, **kwargs)", + "sync_imports": "{\"regular\": {\"azurecore\": {\"azure.core.configuration\": [\"Configuration\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMChallengeAuthenticationPolicy\", \"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\", \"AsyncARMChallengeAuthenticationPolicy\"]}, \"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", + "storages": "StoragesOperations", + "certificates": "CertificatesOperations", + "custom_domains": "CustomDomainsOperations", + "deployments": "DeploymentsOperations", + "operations": "Operations", + "runtime_versions": "RuntimeVersionsOperations", + "skus": "SkusOperations" + } +} \ No newline at end of file diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2021_09_01_preview/_patch.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2021_09_01_preview/_patch.py new file mode 100644 index 0000000000000..74e48ecd07cf3 --- /dev/null +++ b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2021_09_01_preview/_patch.py @@ -0,0 +1,31 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# +# Copyright (c) Microsoft Corporation. All rights reserved. +# +# The MIT License (MIT) +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the ""Software""), to +# deal in the Software without restriction, including without limitation the +# rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +# sell copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in +# all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED *AS IS*, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +# IN THE SOFTWARE. +# +# -------------------------------------------------------------------------- + +# This file is used for handwritten extensions to the generated code. Example: +# https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md +def patch_sdk(): + pass \ No newline at end of file diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2021_09_01_preview/_vendor.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2021_09_01_preview/_vendor.py new file mode 100644 index 0000000000000..138f663c53a4e --- /dev/null +++ b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2021_09_01_preview/_vendor.py @@ -0,0 +1,27 @@ +# -------------------------------------------------------------------------- +# 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 azure.core.pipeline.transport import HttpRequest + +def _convert_request(request, files=None): + data = request.content if not files else None + request = HttpRequest(method=request.method, url=request.url, headers=request.headers, data=data) + if files: + request.set_formdata_body(files) + return request + +def _format_url_section(template, **kwargs): + components = template.split("/") + while components: + try: + return template.format(**kwargs) + except KeyError as key: + formatted_components = template.split("/") + components = [ + c for c in formatted_components if "{}".format(key.args[0]) not in c + ] + template = "/".join(components) diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2021_09_01_preview/_version.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2021_09_01_preview/_version.py new file mode 100644 index 0000000000000..e5754a47ce68f --- /dev/null +++ b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2021_09_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 = "1.0.0b1" diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2021_09_01_preview/aio/__init__.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2021_09_01_preview/aio/__init__.py new file mode 100644 index 0000000000000..44ce4a5043f80 --- /dev/null +++ b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2021_09_01_preview/aio/__init__.py @@ -0,0 +1,15 @@ +# 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'] + +# `._patch.py` is used for handwritten extensions to the generated code +# Example: https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md +from ._patch import patch_sdk +patch_sdk() diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2021_09_01_preview/aio/_app_platform_management_client.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2021_09_01_preview/aio/_app_platform_management_client.py new file mode 100644 index 0000000000000..d4281523a655b --- /dev/null +++ b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2021_09_01_preview/aio/_app_platform_management_client.py @@ -0,0 +1,130 @@ +# 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 copy import deepcopy +from typing import Any, Awaitable, Optional, TYPE_CHECKING + +from azure.core.rest import AsyncHttpResponse, HttpRequest +from azure.mgmt.core import AsyncARMPipelineClient +from msrest import Deserializer, Serializer + +from .. import models +from ._configuration import AppPlatformManagementClientConfiguration +from .operations import AppsOperations, BindingsOperations, CertificatesOperations, ConfigServersOperations, CustomDomainsOperations, DeploymentsOperations, MonitoringSettingsOperations, Operations, RuntimeVersionsOperations, ServicesOperations, SkusOperations, StoragesOperations + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from azure.core.credentials_async import AsyncTokenCredential + +class AppPlatformManagementClient: + """REST API for Azure Spring Cloud. + + :ivar services: ServicesOperations operations + :vartype services: azure.mgmt.appplatform.v2021_09_01_preview.aio.operations.ServicesOperations + :ivar config_servers: ConfigServersOperations operations + :vartype config_servers: + azure.mgmt.appplatform.v2021_09_01_preview.aio.operations.ConfigServersOperations + :ivar monitoring_settings: MonitoringSettingsOperations operations + :vartype monitoring_settings: + azure.mgmt.appplatform.v2021_09_01_preview.aio.operations.MonitoringSettingsOperations + :ivar apps: AppsOperations operations + :vartype apps: azure.mgmt.appplatform.v2021_09_01_preview.aio.operations.AppsOperations + :ivar bindings: BindingsOperations operations + :vartype bindings: azure.mgmt.appplatform.v2021_09_01_preview.aio.operations.BindingsOperations + :ivar storages: StoragesOperations operations + :vartype storages: azure.mgmt.appplatform.v2021_09_01_preview.aio.operations.StoragesOperations + :ivar certificates: CertificatesOperations operations + :vartype certificates: + azure.mgmt.appplatform.v2021_09_01_preview.aio.operations.CertificatesOperations + :ivar custom_domains: CustomDomainsOperations operations + :vartype custom_domains: + azure.mgmt.appplatform.v2021_09_01_preview.aio.operations.CustomDomainsOperations + :ivar deployments: DeploymentsOperations operations + :vartype deployments: + azure.mgmt.appplatform.v2021_09_01_preview.aio.operations.DeploymentsOperations + :ivar operations: Operations operations + :vartype operations: azure.mgmt.appplatform.v2021_09_01_preview.aio.operations.Operations + :ivar runtime_versions: RuntimeVersionsOperations operations + :vartype runtime_versions: + azure.mgmt.appplatform.v2021_09_01_preview.aio.operations.RuntimeVersionsOperations + :ivar skus: SkusOperations operations + :vartype skus: azure.mgmt.appplatform.v2021_09_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 base_url: Service URL. Default value is 'https://management.azure.com'. + :type base_url: str + :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: str = "https://management.azure.com", + **kwargs: Any + ) -> None: + self._config = AppPlatformManagementClientConfiguration(credential=credential, subscription_id=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._deserialize = Deserializer(client_models) + self._serialize.client_side_validation = False + 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.storages = StoragesOperations(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) + + + def _send_request( + self, + request: HttpRequest, + **kwargs: Any + ) -> Awaitable[AsyncHttpResponse]: + """Runs the network request through the client's chained policies. + + >>> from azure.core.rest import HttpRequest + >>> request = HttpRequest("GET", "https://www.example.org/") + + >>> response = await client._send_request(request) + + + For more information on this code flow, see https://aka.ms/azsdk/python/protocol/quickstart + + :param request: The network request you want to make. Required. + :type request: ~azure.core.rest.HttpRequest + :keyword bool stream: Whether the response payload will be streamed. Defaults to False. + :return: The response of your network call. Does not do error handling on your response. + :rtype: ~azure.core.rest.AsyncHttpResponse + """ + + request_copy = deepcopy(request) + request_copy.url = self._client.format_url(request_copy.url) + return self._client.send_request(request_copy, **kwargs) + + 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/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2021_09_01_preview/aio/_configuration.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2021_09_01_preview/aio/_configuration.py new file mode 100644 index 0000000000000..52ce667de37f4 --- /dev/null +++ b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2021_09_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, AsyncARMChallengeAuthenticationPolicy + +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: + super(AppPlatformManagementClientConfiguration, self).__init__(**kwargs) + 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.") + + self.credential = credential + self.subscription_id = subscription_id + self.api_version = "2021-09-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 = AsyncARMChallengeAuthenticationPolicy(self.credential, *self.credential_scopes, **kwargs) diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2021_09_01_preview/aio/_patch.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2021_09_01_preview/aio/_patch.py new file mode 100644 index 0000000000000..74e48ecd07cf3 --- /dev/null +++ b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2021_09_01_preview/aio/_patch.py @@ -0,0 +1,31 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# +# Copyright (c) Microsoft Corporation. All rights reserved. +# +# The MIT License (MIT) +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the ""Software""), to +# deal in the Software without restriction, including without limitation the +# rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +# sell copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in +# all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED *AS IS*, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +# IN THE SOFTWARE. +# +# -------------------------------------------------------------------------- + +# This file is used for handwritten extensions to the generated code. Example: +# https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md +def patch_sdk(): + pass \ No newline at end of file diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2021_09_01_preview/aio/operations/__init__.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2021_09_01_preview/aio/operations/__init__.py new file mode 100644 index 0000000000000..97c71859bbd5f --- /dev/null +++ b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2021_09_01_preview/aio/operations/__init__.py @@ -0,0 +1,35 @@ +# 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 ._storages_operations import StoragesOperations +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', + 'StoragesOperations', + 'CertificatesOperations', + 'CustomDomainsOperations', + 'DeploymentsOperations', + 'Operations', + 'RuntimeVersionsOperations', + 'SkusOperations', +] diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2021_09_01_preview/aio/operations/_apps_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2021_09_01_preview/aio/operations/_apps_operations.py new file mode 100644 index 0000000000000..affae7481c740 --- /dev/null +++ b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2021_09_01_preview/aio/operations/_apps_operations.py @@ -0,0 +1,668 @@ +# 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. +# -------------------------------------------------------------------------- +import functools +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 +from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling + +from ... import models as _models +from ..._vendor import _convert_request +from ...operations._apps_operations import build_create_or_update_request_initial, build_delete_request_initial, build_get_request, build_get_resource_upload_url_request, build_list_request, build_update_request_initial, build_validate_domain_request +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_09_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 + + @distributed_trace_async + 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_09_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', {})) + + + request = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + sync_status=sync_status, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + 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', {})) + + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(app_resource, 'AppResource') + + request = build_create_or_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + 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 + + + @distributed_trace_async + 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_09_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_09_01_preview.models.AppResource] + :raises: ~azure.core.exceptions.HttpResponseError + """ + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.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, + content_type=content_type, + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) + + def get_long_running_output(pipeline_response): + response = pipeline_response.http_response + deserialized = self._deserialize('AppResource', pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **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', {})) + + + request = build_delete_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + 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 + + + @distributed_trace_async + 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, azure.core.polling.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) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) + + + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **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', {})) + + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(app_resource, 'AppResource') + + request = build_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + content_type=content_type, + json=_json, + template_url=self._update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + 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 + + + @distributed_trace_async + 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_09_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_09_01_preview.models.AppResource] + :raises: ~azure.core.exceptions.HttpResponseError + """ + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.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, + content_type=content_type, + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) + + def get_long_running_output(pipeline_response): + response = pipeline_response.http_response + deserialized = self._deserialize('AppResource', pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **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 + + @distributed_trace + 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_09_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', {})) + def prepare_request(next_link=None): + if not next_link: + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + 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 + + @distributed_trace_async + 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_09_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', {})) + + + request = build_get_resource_upload_url_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + template_url=self.get_resource_upload_url.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + 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 + + + @distributed_trace_async + 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_09_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_09_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', {})) + + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(validate_payload, 'CustomDomainValidatePayload') + + request = build_validate_domain_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + content_type=content_type, + json=_json, + template_url=self.validate_domain.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + 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/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2021_09_01_preview/aio/operations/_bindings_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2021_09_01_preview/aio/operations/_bindings_operations.py new file mode 100644 index 0000000000000..836b9358c87ca --- /dev/null +++ b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2021_09_01_preview/aio/operations/_bindings_operations.py @@ -0,0 +1,570 @@ +# 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. +# -------------------------------------------------------------------------- +import functools +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 +from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling + +from ... import models as _models +from ..._vendor import _convert_request +from ...operations._bindings_operations import build_create_or_update_request_initial, build_delete_request_initial, build_get_request, build_list_request, build_update_request_initial +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_09_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 + + @distributed_trace_async + 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_09_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', {})) + + + request = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + binding_name=binding_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + 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', {})) + + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(binding_resource, 'BindingResource') + + request = build_create_or_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + binding_name=binding_name, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + 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 + + + @distributed_trace_async + 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_09_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_09_01_preview.models.BindingResource] + :raises: ~azure.core.exceptions.HttpResponseError + """ + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.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, + content_type=content_type, + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) + + def get_long_running_output(pipeline_response): + response = pipeline_response.http_response + deserialized = self._deserialize('BindingResource', pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **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', {})) + + + request = build_delete_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + binding_name=binding_name, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + 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 + + + @distributed_trace_async + 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, azure.core.polling.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) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) + + + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **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', {})) + + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(binding_resource, 'BindingResource') + + request = build_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + binding_name=binding_name, + content_type=content_type, + json=_json, + template_url=self._update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + 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 + + + @distributed_trace_async + 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_09_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_09_01_preview.models.BindingResource] + :raises: ~azure.core.exceptions.HttpResponseError + """ + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.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, + content_type=content_type, + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) + + def get_long_running_output(pipeline_response): + response = pipeline_response.http_response + deserialized = self._deserialize('BindingResource', pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **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 + + @distributed_trace + 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_09_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', {})) + def prepare_request(next_link=None): + if not next_link: + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + 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/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2021_09_01_preview/aio/operations/_certificates_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2021_09_01_preview/aio/operations/_certificates_operations.py new file mode 100644 index 0000000000000..09b403694ae19 --- /dev/null +++ b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2021_09_01_preview/aio/operations/_certificates_operations.py @@ -0,0 +1,416 @@ +# 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. +# -------------------------------------------------------------------------- +import functools +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 +from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling + +from ... import models as _models +from ..._vendor import _convert_request +from ...operations._certificates_operations import build_create_or_update_request_initial, build_delete_request_initial, build_get_request, build_list_request +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_09_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 + + @distributed_trace_async + 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_09_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', {})) + + + request = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + certificate_name=certificate_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + 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', {})) + + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(certificate_resource, 'CertificateResource') + + request = build_create_or_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + certificate_name=certificate_name, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + 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 + + + @distributed_trace_async + 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_09_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_09_01_preview.models.CertificateResource] + :raises: ~azure.core.exceptions.HttpResponseError + """ + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.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, + content_type=content_type, + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) + + def get_long_running_output(pipeline_response): + response = pipeline_response.http_response + deserialized = self._deserialize('CertificateResource', pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **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', {})) + + + request = build_delete_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + certificate_name=certificate_name, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + 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 + + + @distributed_trace_async + 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, azure.core.polling.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) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) + + + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **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 + + @distributed_trace + 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_09_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', {})) + def prepare_request(next_link=None): + if not next_link: + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + 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/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2021_09_01_preview/aio/operations/_config_servers_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2021_09_01_preview/aio/operations/_config_servers_operations.py new file mode 100644 index 0000000000000..73625b4a9904b --- /dev/null +++ b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2021_09_01_preview/aio/operations/_config_servers_operations.py @@ -0,0 +1,468 @@ +# 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. +# -------------------------------------------------------------------------- +import functools +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 +from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator_async import distributed_trace_async +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling + +from ... import models as _models +from ..._vendor import _convert_request +from ...operations._config_servers_operations import build_get_request, build_update_patch_request_initial, build_update_put_request_initial, build_validate_request_initial +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_09_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 + + @distributed_trace_async + 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_09_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', {})) + + + request = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + 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', {})) + + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(config_server_resource, 'ConfigServerResource') + + request = build_update_put_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + content_type=content_type, + json=_json, + template_url=self._update_put_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + 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 + + + @distributed_trace_async + 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_09_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_09_01_preview.models.ConfigServerResource] + :raises: ~azure.core.exceptions.HttpResponseError + """ + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.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, + content_type=content_type, + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) + + def get_long_running_output(pipeline_response): + response = pipeline_response.http_response + deserialized = self._deserialize('ConfigServerResource', pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **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', {})) + + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(config_server_resource, 'ConfigServerResource') + + request = build_update_patch_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + content_type=content_type, + json=_json, + template_url=self._update_patch_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + 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 + + + @distributed_trace_async + 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_09_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_09_01_preview.models.ConfigServerResource] + :raises: ~azure.core.exceptions.HttpResponseError + """ + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.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, + content_type=content_type, + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) + + def get_long_running_output(pipeline_response): + response = pipeline_response.http_response + deserialized = self._deserialize('ConfigServerResource', pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **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', {})) + + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(config_server_settings, 'ConfigServerSettings') + + request = build_validate_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + content_type=content_type, + json=_json, + template_url=self._validate_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + 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 + + + @distributed_trace_async + 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_09_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_09_01_preview.models.ConfigServerSettingsValidateResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.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, + content_type=content_type, + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) + + def get_long_running_output(pipeline_response): + response = pipeline_response.http_response + deserialized = self._deserialize('ConfigServerSettingsValidateResult', pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, **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/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2021_09_01_preview/aio/operations/_custom_domains_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2021_09_01_preview/aio/operations/_custom_domains_operations.py new file mode 100644 index 0000000000000..82e57a30012c4 --- /dev/null +++ b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2021_09_01_preview/aio/operations/_custom_domains_operations.py @@ -0,0 +1,570 @@ +# 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. +# -------------------------------------------------------------------------- +import functools +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 +from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling + +from ... import models as _models +from ..._vendor import _convert_request +from ...operations._custom_domains_operations import build_create_or_update_request_initial, build_delete_request_initial, build_get_request, build_list_request, build_update_request_initial +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_09_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 + + @distributed_trace_async + 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_09_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', {})) + + + request = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + domain_name=domain_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + 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', {})) + + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(domain_resource, 'CustomDomainResource') + + request = build_create_or_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + domain_name=domain_name, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + 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 + + + @distributed_trace_async + 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_09_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_09_01_preview.models.CustomDomainResource] + :raises: ~azure.core.exceptions.HttpResponseError + """ + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.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, + content_type=content_type, + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) + + def get_long_running_output(pipeline_response): + response = pipeline_response.http_response + deserialized = self._deserialize('CustomDomainResource', pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **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', {})) + + + request = build_delete_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + domain_name=domain_name, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + 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 + + + @distributed_trace_async + 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, azure.core.polling.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) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) + + + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **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', {})) + + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(domain_resource, 'CustomDomainResource') + + request = build_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + domain_name=domain_name, + content_type=content_type, + json=_json, + template_url=self._update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + 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 + + + @distributed_trace_async + 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_09_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_09_01_preview.models.CustomDomainResource] + :raises: ~azure.core.exceptions.HttpResponseError + """ + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.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, + content_type=content_type, + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) + + def get_long_running_output(pipeline_response): + response = pipeline_response.http_response + deserialized = self._deserialize('CustomDomainResource', pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **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 + + @distributed_trace + 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_09_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', {})) + def prepare_request(next_link=None): + if not next_link: + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + 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/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2021_09_01_preview/aio/operations/_deployments_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2021_09_01_preview/aio/operations/_deployments_operations.py new file mode 100644 index 0000000000000..3c9c8d9741b00 --- /dev/null +++ b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2021_09_01_preview/aio/operations/_deployments_operations.py @@ -0,0 +1,1413 @@ +# 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. +# -------------------------------------------------------------------------- +import functools +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 +from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling + +from ... import models as _models +from ..._vendor import _convert_request +from ...operations._deployments_operations import build_create_or_update_request_initial, build_delete_request_initial, build_generate_heap_dump_request_initial, build_generate_thread_dump_request_initial, build_get_log_file_url_request, build_get_request, build_list_for_cluster_request, build_list_request, build_restart_request_initial, build_start_jfr_request_initial, build_start_request_initial, build_stop_request_initial, build_update_request_initial +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_09_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 + + @distributed_trace_async + 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_09_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', {})) + + + request = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + deployment_name=deployment_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + 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', {})) + + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(deployment_resource, 'DeploymentResource') + + request = build_create_or_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + deployment_name=deployment_name, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + 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 + + + @distributed_trace_async + 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_09_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_09_01_preview.models.DeploymentResource] + :raises: ~azure.core.exceptions.HttpResponseError + """ + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.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, + content_type=content_type, + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) + + def get_long_running_output(pipeline_response): + response = pipeline_response.http_response + deserialized = self._deserialize('DeploymentResource', pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **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', {})) + + + request = build_delete_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + deployment_name=deployment_name, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + 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 + + + @distributed_trace_async + 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, azure.core.polling.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) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) + + + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **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', {})) + + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(deployment_resource, 'DeploymentResource') + + request = build_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + deployment_name=deployment_name, + content_type=content_type, + json=_json, + template_url=self._update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + 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 + + + @distributed_trace_async + 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_09_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_09_01_preview.models.DeploymentResource] + :raises: ~azure.core.exceptions.HttpResponseError + """ + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.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, + content_type=content_type, + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) + + def get_long_running_output(pipeline_response): + response = pipeline_response.http_response + deserialized = self._deserialize('DeploymentResource', pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **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 + + @distributed_trace + 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_09_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', {})) + def prepare_request(next_link=None): + if not next_link: + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + version=version, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + version=version, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + 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 + + @distributed_trace + 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_09_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', {})) + def prepare_request(next_link=None): + if not next_link: + + request = build_list_for_cluster_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + version=version, + template_url=self.list_for_cluster.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + + request = build_list_for_cluster_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + version=version, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + 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', {})) + + + request = build_start_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + deployment_name=deployment_name, + template_url=self._start_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + 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 + + + @distributed_trace_async + 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, azure.core.polling.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) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) + + + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **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', {})) + + + request = build_stop_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + deployment_name=deployment_name, + template_url=self._stop_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + 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 + + + @distributed_trace_async + 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, azure.core.polling.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) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) + + + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **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', {})) + + + request = build_restart_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + deployment_name=deployment_name, + template_url=self._restart_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + 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 + + + @distributed_trace_async + 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, azure.core.polling.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) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) + + + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **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 + + @distributed_trace_async + 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_09_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', {})) + + + request = build_get_log_file_url_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + deployment_name=deployment_name, + template_url=self.get_log_file_url.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + 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 + + + async def _generate_heap_dump_initial( + self, + resource_group_name: str, + service_name: str, + app_name: str, + deployment_name: str, + diagnostic_parameters: "_models.DiagnosticParameters", + **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', {})) + + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(diagnostic_parameters, 'DiagnosticParameters') + + request = build_generate_heap_dump_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + deployment_name=deployment_name, + content_type=content_type, + json=_json, + template_url=self._generate_heap_dump_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + 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, {}) + + _generate_heap_dump_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/generateHeapDump'} # type: ignore + + + @distributed_trace_async + async def begin_generate_heap_dump( + self, + resource_group_name: str, + service_name: str, + app_name: str, + deployment_name: str, + diagnostic_parameters: "_models.DiagnosticParameters", + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Generate Heap Dump. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure 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 diagnostic_parameters: Parameters for the diagnostic operation. + :type diagnostic_parameters: + ~azure.mgmt.appplatform.v2021_09_01_preview.models.DiagnosticParameters + :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 + """ + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.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._generate_heap_dump_initial( + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + deployment_name=deployment_name, + diagnostic_parameters=diagnostic_parameters, + content_type=content_type, + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) + + + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **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_generate_heap_dump.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/generateHeapDump'} # type: ignore + + async def _generate_thread_dump_initial( + self, + resource_group_name: str, + service_name: str, + app_name: str, + deployment_name: str, + diagnostic_parameters: "_models.DiagnosticParameters", + **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', {})) + + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(diagnostic_parameters, 'DiagnosticParameters') + + request = build_generate_thread_dump_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + deployment_name=deployment_name, + content_type=content_type, + json=_json, + template_url=self._generate_thread_dump_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + 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, {}) + + _generate_thread_dump_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/generateThreadDump'} # type: ignore + + + @distributed_trace_async + async def begin_generate_thread_dump( + self, + resource_group_name: str, + service_name: str, + app_name: str, + deployment_name: str, + diagnostic_parameters: "_models.DiagnosticParameters", + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Generate Thread Dump. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure 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 diagnostic_parameters: Parameters for the diagnostic operation. + :type diagnostic_parameters: + ~azure.mgmt.appplatform.v2021_09_01_preview.models.DiagnosticParameters + :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 + """ + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.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._generate_thread_dump_initial( + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + deployment_name=deployment_name, + diagnostic_parameters=diagnostic_parameters, + content_type=content_type, + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) + + + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **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_generate_thread_dump.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/generateThreadDump'} # type: ignore + + async def _start_jfr_initial( + self, + resource_group_name: str, + service_name: str, + app_name: str, + deployment_name: str, + diagnostic_parameters: "_models.DiagnosticParameters", + **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', {})) + + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(diagnostic_parameters, 'DiagnosticParameters') + + request = build_start_jfr_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + deployment_name=deployment_name, + content_type=content_type, + json=_json, + template_url=self._start_jfr_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + 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_jfr_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/StartJFR'} # type: ignore + + + @distributed_trace_async + async def begin_start_jfr( + self, + resource_group_name: str, + service_name: str, + app_name: str, + deployment_name: str, + diagnostic_parameters: "_models.DiagnosticParameters", + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Start JFR. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure 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 diagnostic_parameters: Parameters for the diagnostic operation. + :type diagnostic_parameters: + ~azure.mgmt.appplatform.v2021_09_01_preview.models.DiagnosticParameters + :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 + """ + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.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_jfr_initial( + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + deployment_name=deployment_name, + diagnostic_parameters=diagnostic_parameters, + content_type=content_type, + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) + + + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **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_jfr.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/StartJFR'} # type: ignore diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2021_09_01_preview/aio/operations/_monitoring_settings_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2021_09_01_preview/aio/operations/_monitoring_settings_operations.py new file mode 100644 index 0000000000000..01ce2c280904e --- /dev/null +++ b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2021_09_01_preview/aio/operations/_monitoring_settings_operations.py @@ -0,0 +1,345 @@ +# 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. +# -------------------------------------------------------------------------- +import functools +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 +from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator_async import distributed_trace_async +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling + +from ... import models as _models +from ..._vendor import _convert_request +from ...operations._monitoring_settings_operations import build_get_request, build_update_patch_request_initial, build_update_put_request_initial +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_09_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 + + @distributed_trace_async + 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_09_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', {})) + + + request = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + 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', {})) + + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(monitoring_setting_resource, 'MonitoringSettingResource') + + request = build_update_put_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + content_type=content_type, + json=_json, + template_url=self._update_put_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + 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 + + + @distributed_trace_async + 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_09_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_09_01_preview.models.MonitoringSettingResource] + :raises: ~azure.core.exceptions.HttpResponseError + """ + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.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, + content_type=content_type, + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) + + def get_long_running_output(pipeline_response): + response = pipeline_response.http_response + deserialized = self._deserialize('MonitoringSettingResource', pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **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', {})) + + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(monitoring_setting_resource, 'MonitoringSettingResource') + + request = build_update_patch_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + content_type=content_type, + json=_json, + template_url=self._update_patch_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + 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 + + + @distributed_trace_async + 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_09_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_09_01_preview.models.MonitoringSettingResource] + :raises: ~azure.core.exceptions.HttpResponseError + """ + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.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, + content_type=content_type, + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) + + def get_long_running_output(pipeline_response): + response = pipeline_response.http_response + deserialized = self._deserialize('MonitoringSettingResource', pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **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/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2021_09_01_preview/aio/operations/_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2021_09_01_preview/aio/operations/_operations.py new file mode 100644 index 0000000000000..4e25d107300a2 --- /dev/null +++ b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2021_09_01_preview/aio/operations/_operations.py @@ -0,0 +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. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import functools +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 +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async +from azure.mgmt.core.exceptions import ARMErrorFormat + +from ... import models as _models +from ..._vendor import _convert_request +from ...operations._operations import build_list_request +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_09_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 + + @distributed_trace + 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_09_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', {})) + def prepare_request(next_link=None): + if not next_link: + + request = build_list_request( + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + + request = build_list_request( + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + 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/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2021_09_01_preview/aio/operations/_runtime_versions_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2021_09_01_preview/aio/operations/_runtime_versions_operations.py new file mode 100644 index 0000000000000..f2d67ee1d73be --- /dev/null +++ b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2021_09_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. +# -------------------------------------------------------------------------- +import functools +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 +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator_async import distributed_trace_async +from azure.mgmt.core.exceptions import ARMErrorFormat + +from ... import models as _models +from ..._vendor import _convert_request +from ...operations._runtime_versions_operations import build_list_runtime_versions_request +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_09_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 + + @distributed_trace_async + 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_09_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', {})) + + + request = build_list_runtime_versions_request( + template_url=self.list_runtime_versions.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + 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/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2021_09_01_preview/aio/operations/_services_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2021_09_01_preview/aio/operations/_services_operations.py new file mode 100644 index 0000000000000..06a90d5357381 --- /dev/null +++ b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2021_09_01_preview/aio/operations/_services_operations.py @@ -0,0 +1,1042 @@ +# 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. +# -------------------------------------------------------------------------- +import functools +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 +from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling + +from ... import models as _models +from ..._vendor import _convert_request +from ...operations._services_operations import build_check_name_availability_request, build_create_or_update_request_initial, build_delete_request_initial, build_disable_test_endpoint_request, build_enable_test_endpoint_request, build_get_request, build_list_by_subscription_request, build_list_request, build_list_test_keys_request, build_regenerate_test_key_request, build_start_request_initial, build_stop_request_initial, build_update_request_initial +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_09_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 + + @distributed_trace_async + 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_09_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', {})) + + + request = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + 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', {})) + + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(resource, 'ServiceResource') + + request = build_create_or_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + 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 + + + @distributed_trace_async + 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_09_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_09_01_preview.models.ServiceResource] + :raises: ~azure.core.exceptions.HttpResponseError + """ + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.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, + content_type=content_type, + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) + + def get_long_running_output(pipeline_response): + response = pipeline_response.http_response + deserialized = self._deserialize('ServiceResource', pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **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', {})) + + + request = build_delete_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + 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 + + + @distributed_trace_async + 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, azure.core.polling.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) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) + + + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **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', {})) + + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(resource, 'ServiceResource') + + request = build_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + content_type=content_type, + json=_json, + template_url=self._update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + 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 + + + @distributed_trace_async + 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_09_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_09_01_preview.models.ServiceResource] + :raises: ~azure.core.exceptions.HttpResponseError + """ + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.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, + content_type=content_type, + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) + + def get_long_running_output(pipeline_response): + response = pipeline_response.http_response + deserialized = self._deserialize('ServiceResource', pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **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 + + @distributed_trace_async + 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_09_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', {})) + + + request = build_list_test_keys_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + template_url=self.list_test_keys.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + 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 + + + @distributed_trace_async + 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_09_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_09_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', {})) + + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(regenerate_test_key_request, 'RegenerateTestKeyRequestPayload') + + request = build_regenerate_test_key_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + content_type=content_type, + json=_json, + template_url=self.regenerate_test_key.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + 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 + + + @distributed_trace_async + 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', {})) + + + request = build_disable_test_endpoint_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + template_url=self.disable_test_endpoint.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + 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 + + + @distributed_trace_async + 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_09_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', {})) + + + request = build_enable_test_endpoint_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + template_url=self.enable_test_endpoint.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + 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 _stop_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', {})) + + + request = build_stop_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + template_url=self._stop_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [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}/stop'} # type: ignore + + + @distributed_trace_async + async def begin_stop( + self, + resource_group_name: str, + service_name: str, + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Stop 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, azure.core.polling.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, + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) + + + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **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}/stop'} # type: ignore + + async def _start_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', {})) + + + request = build_start_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + template_url=self._start_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [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}/start'} # type: ignore + + + @distributed_trace_async + async def begin_start( + self, + resource_group_name: str, + service_name: str, + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Start 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, azure.core.polling.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, + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) + + + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **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}/start'} # type: ignore + + @distributed_trace_async + 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_09_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_09_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', {})) + + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(availability_parameters, 'NameAvailabilityParameters') + + request = build_check_name_availability_request( + subscription_id=self._config.subscription_id, + location=location, + content_type=content_type, + json=_json, + template_url=self.check_name_availability.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + 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 + + + @distributed_trace + 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_09_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', {})) + def prepare_request(next_link=None): + if not next_link: + + request = build_list_by_subscription_request( + subscription_id=self._config.subscription_id, + template_url=self.list_by_subscription.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + + request = build_list_by_subscription_request( + subscription_id=self._config.subscription_id, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + 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 + + @distributed_trace + 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_09_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', {})) + def prepare_request(next_link=None): + if not next_link: + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + 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/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2021_09_01_preview/aio/operations/_skus_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2021_09_01_preview/aio/operations/_skus_operations.py new file mode 100644 index 0000000000000..b9e15478f5c80 --- /dev/null +++ b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2021_09_01_preview/aio/operations/_skus_operations.py @@ -0,0 +1,112 @@ +# 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. +# -------------------------------------------------------------------------- +import functools +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 +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async +from azure.mgmt.core.exceptions import ARMErrorFormat + +from ... import models as _models +from ..._vendor import _convert_request +from ...operations._skus_operations import build_list_request +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_09_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 + + @distributed_trace + 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_09_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', {})) + def prepare_request(next_link=None): + if not next_link: + + request = build_list_request( + subscription_id=self._config.subscription_id, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + + request = build_list_request( + subscription_id=self._config.subscription_id, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + 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/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2021_09_01_preview/aio/operations/_storages_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2021_09_01_preview/aio/operations/_storages_operations.py new file mode 100644 index 0000000000000..d9fe383575589 --- /dev/null +++ b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2021_09_01_preview/aio/operations/_storages_operations.py @@ -0,0 +1,415 @@ +# 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. +# -------------------------------------------------------------------------- +import functools +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 +from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling + +from ... import models as _models +from ..._vendor import _convert_request +from ...operations._storages_operations import build_create_or_update_request_initial, build_delete_request_initial, build_get_request, build_list_request +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + +class StoragesOperations: + """StoragesOperations 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_09_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 + + @distributed_trace_async + async def get( + self, + resource_group_name: str, + service_name: str, + storage_name: str, + **kwargs: Any + ) -> "_models.StorageResource": + """Get the storage 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 storage_name: The name of the storage resource. + :type storage_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: StorageResource, or the result of cls(response) + :rtype: ~azure.mgmt.appplatform.v2021_09_01_preview.models.StorageResource + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.StorageResource"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + storage_name=storage_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + 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('StorageResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/storages/{storageName}'} # type: ignore + + + async def _create_or_update_initial( + self, + resource_group_name: str, + service_name: str, + storage_name: str, + storage_resource: "_models.StorageResource", + **kwargs: Any + ) -> "_models.StorageResource": + cls = kwargs.pop('cls', None) # type: ClsType["_models.StorageResource"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(storage_resource, 'StorageResource') + + request = build_create_or_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + storage_name=storage_name, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + 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('StorageResource', pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize('StorageResource', pipeline_response) + + if response.status_code == 202: + deserialized = self._deserialize('StorageResource', 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}/storages/{storageName}'} # type: ignore + + + @distributed_trace_async + async def begin_create_or_update( + self, + resource_group_name: str, + service_name: str, + storage_name: str, + storage_resource: "_models.StorageResource", + **kwargs: Any + ) -> AsyncLROPoller["_models.StorageResource"]: + """Create or update storage 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 storage_name: The name of the storage resource. + :type storage_name: str + :param storage_resource: Parameters for the create or update operation. + :type storage_resource: ~azure.mgmt.appplatform.v2021_09_01_preview.models.StorageResource + :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 StorageResource or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2021_09_01_preview.models.StorageResource] + :raises: ~azure.core.exceptions.HttpResponseError + """ + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.StorageResource"] + 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, + storage_name=storage_name, + storage_resource=storage_resource, + content_type=content_type, + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) + + def get_long_running_output(pipeline_response): + response = pipeline_response.http_response + deserialized = self._deserialize('StorageResource', pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **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}/storages/{storageName}'} # type: ignore + + async def _delete_initial( + self, + resource_group_name: str, + service_name: str, + storage_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', {})) + + + request = build_delete_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + storage_name=storage_name, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + 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}/storages/{storageName}'} # type: ignore + + + @distributed_trace_async + async def begin_delete( + self, + resource_group_name: str, + service_name: str, + storage_name: str, + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Delete the storage 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 storage_name: The name of the storage resource. + :type storage_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, azure.core.polling.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, + storage_name=storage_name, + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) + + + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **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}/storages/{storageName}'} # type: ignore + + @distributed_trace + def list( + self, + resource_group_name: str, + service_name: str, + **kwargs: Any + ) -> AsyncIterable["_models.StorageResourceCollection"]: + """List all the storages of one Azure Spring Cloud instance. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure 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 StorageResourceCollection or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2021_09_01_preview.models.StorageResourceCollection] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.StorageResourceCollection"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + def prepare_request(next_link=None): + if not next_link: + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize("StorageResourceCollection", 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}/storages'} # type: ignore diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2021_09_01_preview/models/__init__.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2021_09_01_preview/models/__init__.py new file mode 100644 index 0000000000000..e6f85ad2989ae --- /dev/null +++ b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2021_09_01_preview/models/__init__.py @@ -0,0 +1,309 @@ +# 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. +# -------------------------------------------------------------------------- + +try: + 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 AzureFileVolume + 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 ConfigServerResource + from ._models_py3 import ConfigServerSettings + from ._models_py3 import ConfigServerSettingsErrorRecord + from ._models_py3 import ConfigServerSettingsValidateResult + from ._models_py3 import ContentCertificateProperties + 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 CustomPersistentDiskProperties + from ._models_py3 import CustomPersistentDiskResource + 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 DeploymentSettingsContainerProbeSettings + from ._models_py3 import DiagnosticParameters + from ._models_py3 import Error + from ._models_py3 import GitPatternRepository + from ._models_py3 import ImageRegistryCredential + from ._models_py3 import KeyVaultCertificateProperties + from ._models_py3 import LoadedCertificate + from ._models_py3 import LogFileUrlResponse + from ._models_py3 import LogSpecification + from ._models_py3 import ManagedIdentityProperties + from ._models_py3 import MetricDimension + from ._models_py3 import MetricSpecification + from ._models_py3 import MonitoringSettingProperties + from ._models_py3 import MonitoringSettingResource + from ._models_py3 import NameAvailability + from ._models_py3 import NameAvailabilityParameters + from ._models_py3 import NetworkProfile + from ._models_py3 import NetworkProfileOutboundIPs + from ._models_py3 import OperationDetail + from ._models_py3 import OperationDisplay + from ._models_py3 import OperationProperties + from ._models_py3 import PersistentDisk + from ._models_py3 import ProxyResource + from ._models_py3 import RegenerateTestKeyRequestPayload + from ._models_py3 import RequiredTraffic + from ._models_py3 import Resource + 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 + from ._models_py3 import StorageAccount + from ._models_py3 import StorageProperties + from ._models_py3 import StorageResource + from ._models_py3 import StorageResourceCollection + from ._models_py3 import SupportedRuntimeVersion + from ._models_py3 import SystemData + from ._models_py3 import TemporaryDisk + from ._models_py3 import TestKeys + from ._models_py3 import TrackedResource + from ._models_py3 import UserSourceInfo +except (SyntaxError, ImportError): + 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 AzureFileVolume # 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 ContentCertificateProperties # 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 CustomPersistentDiskProperties # type: ignore + from ._models import CustomPersistentDiskResource # 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 DeploymentSettingsContainerProbeSettings # type: ignore + from ._models import DiagnosticParameters # type: ignore + from ._models import Error # type: ignore + from ._models import GitPatternRepository # type: ignore + from ._models import ImageRegistryCredential # type: ignore + from ._models import KeyVaultCertificateProperties # type: ignore + from ._models import LoadedCertificate # 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 StorageAccount # type: ignore + from ._models import StorageProperties # type: ignore + from ._models import StorageResource # type: ignore + from ._models import StorageResourceCollection # type: ignore + from ._models import SupportedRuntimeVersion # type: ignore + from ._models import SystemData # 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 ( + ActionType, + AppResourceProvisioningState, + ConfigServerState, + CreatedByType, + DeploymentResourceProvisioningState, + DeploymentResourceStatus, + ManagedIdentityType, + MonitoringSettingState, + PowerState, + ProvisioningState, + ResourceSkuRestrictionsReasonCode, + ResourceSkuRestrictionsType, + RuntimeVersion, + SkuScaleType, + SupportedRuntimePlatform, + SupportedRuntimeValue, + TestKeyType, + TrafficDirection, + UserSourceType, +) + +__all__ = [ + 'AppResource', + 'AppResourceCollection', + 'AppResourceProperties', + 'ApplicationInsightsAgentVersions', + 'AvailableOperations', + 'AvailableRuntimeVersions', + 'AzureFileVolume', + 'BindingResource', + 'BindingResourceCollection', + 'BindingResourceProperties', + 'CertificateProperties', + 'CertificateResource', + 'CertificateResourceCollection', + 'CloudErrorBody', + 'ClusterResourceProperties', + 'ConfigServerGitProperty', + 'ConfigServerProperties', + 'ConfigServerResource', + 'ConfigServerSettings', + 'ConfigServerSettingsErrorRecord', + 'ConfigServerSettingsValidateResult', + 'ContentCertificateProperties', + 'CustomContainer', + 'CustomDomainProperties', + 'CustomDomainResource', + 'CustomDomainResourceCollection', + 'CustomDomainValidatePayload', + 'CustomDomainValidateResult', + 'CustomPersistentDiskProperties', + 'CustomPersistentDiskResource', + 'DeploymentInstance', + 'DeploymentResource', + 'DeploymentResourceCollection', + 'DeploymentResourceProperties', + 'DeploymentSettings', + 'DeploymentSettingsContainerProbeSettings', + 'DiagnosticParameters', + 'Error', + 'GitPatternRepository', + 'ImageRegistryCredential', + 'KeyVaultCertificateProperties', + 'LoadedCertificate', + 'LogFileUrlResponse', + 'LogSpecification', + 'ManagedIdentityProperties', + 'MetricDimension', + 'MetricSpecification', + 'MonitoringSettingProperties', + 'MonitoringSettingResource', + 'NameAvailability', + 'NameAvailabilityParameters', + 'NetworkProfile', + 'NetworkProfileOutboundIPs', + 'OperationDetail', + 'OperationDisplay', + 'OperationProperties', + 'PersistentDisk', + 'ProxyResource', + 'RegenerateTestKeyRequestPayload', + 'RequiredTraffic', + 'Resource', + 'ResourceRequests', + 'ResourceSku', + 'ResourceSkuCapabilities', + 'ResourceSkuCollection', + 'ResourceSkuLocationInfo', + 'ResourceSkuRestrictionInfo', + 'ResourceSkuRestrictions', + 'ResourceSkuZoneDetails', + 'ResourceUploadDefinition', + 'ServiceResource', + 'ServiceResourceList', + 'ServiceSpecification', + 'Sku', + 'SkuCapacity', + 'StorageAccount', + 'StorageProperties', + 'StorageResource', + 'StorageResourceCollection', + 'SupportedRuntimeVersion', + 'SystemData', + 'TemporaryDisk', + 'TestKeys', + 'TrackedResource', + 'UserSourceInfo', + 'ActionType', + 'AppResourceProvisioningState', + 'ConfigServerState', + 'CreatedByType', + 'DeploymentResourceProvisioningState', + 'DeploymentResourceStatus', + 'ManagedIdentityType', + 'MonitoringSettingState', + 'PowerState', + 'ProvisioningState', + 'ResourceSkuRestrictionsReasonCode', + 'ResourceSkuRestrictionsType', + 'RuntimeVersion', + 'SkuScaleType', + 'SupportedRuntimePlatform', + 'SupportedRuntimeValue', + 'TestKeyType', + 'TrafficDirection', + 'UserSourceType', +] diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2021_09_01_preview/models/_app_platform_management_client_enums.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2021_09_01_preview/models/_app_platform_management_client_enums.py new file mode 100644 index 0000000000000..52c3fc50c69f6 --- /dev/null +++ b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2021_09_01_preview/models/_app_platform_management_client_enums.py @@ -0,0 +1,175 @@ +# 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 enum import Enum +from six import with_metaclass +from azure.core import CaseInsensitiveEnumMeta + + +class ActionType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): + """Enum. Indicates the action type. "Internal" refers to actions that are for internal only APIs. + """ + + INTERNAL = "Internal" + +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 CreatedByType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): + """The type of identity that created the resource. + """ + + USER = "User" + APPLICATION = "Application" + MANAGED_IDENTITY = "ManagedIdentity" + KEY = "Key" + +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 PowerState(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): + """Power state of the Service + """ + + RUNNING = "Running" + STOPPED = "Stopped" + +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/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2021_09_01_preview/models/_models.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2021_09_01_preview/models/_models.py new file mode 100644 index 0000000000000..9a37be495c6ff --- /dev/null +++ b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2021_09_01_preview/models/_models.py @@ -0,0 +1,3761 @@ +# 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. +# -------------------------------------------------------------------------- + +import msrest.serialization + + +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. + + :ivar java: Indicates the version of application insight java agent. + :vartype java: str + """ + + _validation = { + 'java': {'readonly': True}, + } + + _attribute_map = { + 'java': {'key': 'java', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + """ + """ + super(ApplicationInsightsAgentVersions, self).__init__(**kwargs) + self.java = None + + +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. + + :ivar id: Fully qualified resource Id for the resource. + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. + :vartype type: str + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + """ + """ + super(Resource, self).__init__(**kwargs) + self.id = None + self.name = None + self.type = None + + +class ProxyResource(Resource): + """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. + + :ivar id: Fully qualified resource Id for the resource. + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. + :vartype type: str + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + } + + 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. + + :ivar id: Fully qualified resource Id for the resource. + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. + :vartype type: str + :ivar properties: Properties of the App resource. + :vartype properties: ~azure.mgmt.appplatform.v2021_09_01_preview.models.AppResourceProperties + :ivar identity: The Managed Identity type of the app resource. + :vartype identity: ~azure.mgmt.appplatform.v2021_09_01_preview.models.ManagedIdentityProperties + :ivar location: The GEO location of the application, always the same with its parent resource. + :vartype location: str + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'properties': {'key': 'properties', 'type': 'AppResourceProperties'}, + 'identity': {'key': 'identity', 'type': 'ManagedIdentityProperties'}, + 'location': {'key': 'location', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + """ + :keyword properties: Properties of the App resource. + :paramtype properties: ~azure.mgmt.appplatform.v2021_09_01_preview.models.AppResourceProperties + :keyword identity: The Managed Identity type of the app resource. + :paramtype identity: + ~azure.mgmt.appplatform.v2021_09_01_preview.models.ManagedIdentityProperties + :keyword location: The GEO location of the application, always the same with its parent + resource. + :paramtype location: str + """ + super(AppResource, self).__init__(**kwargs) + self.properties = kwargs.get('properties', None) + self.identity = kwargs.get('identity', None) + self.location = kwargs.get('location', None) + + +class AppResourceCollection(msrest.serialization.Model): + """Object that includes an array of App resources and a possible link for next set. + + :ivar value: Collection of App resources. + :vartype value: list[~azure.mgmt.appplatform.v2021_09_01_preview.models.AppResource] + :ivar next_link: URL client should use to fetch the next page (per server side paging). + It's null for now, added for future use. + :vartype next_link: str + """ + + _attribute_map = { + 'value': {'key': 'value', 'type': '[AppResource]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + """ + :keyword value: Collection of App resources. + :paramtype value: list[~azure.mgmt.appplatform.v2021_09_01_preview.models.AppResource] + :keyword next_link: URL client should use to fetch the next page (per server side paging). + It's null for now, added for future use. + :paramtype next_link: str + """ + 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. + + :ivar public: Indicates whether the App exposes public endpoint. + :vartype public: bool + :ivar url: URL of the App. + :vartype url: str + :ivar provisioning_state: Provisioning state of the App. Possible values include: "Succeeded", + "Failed", "Creating", "Updating". + :vartype provisioning_state: str or + ~azure.mgmt.appplatform.v2021_09_01_preview.models.AppResourceProvisioningState + :ivar active_deployment_name: Name of the active deployment of the App. + :vartype active_deployment_name: str + :ivar fqdn: Fully qualified dns Name. + :vartype fqdn: str + :ivar https_only: Indicate if only https is allowed. + :vartype https_only: bool + :ivar created_time: Date time when the resource is created. + :vartype created_time: ~datetime.datetime + :ivar temporary_disk: Temporary disk settings. + :vartype temporary_disk: ~azure.mgmt.appplatform.v2021_09_01_preview.models.TemporaryDisk + :ivar persistent_disk: Persistent disk settings. + :vartype persistent_disk: ~azure.mgmt.appplatform.v2021_09_01_preview.models.PersistentDisk + :ivar custom_persistent_disks: List of custom persistent disks. + :vartype custom_persistent_disks: + list[~azure.mgmt.appplatform.v2021_09_01_preview.models.CustomPersistentDiskResource] + :ivar enable_end_to_end_tls: Indicate if end to end TLS is enabled. + :vartype enable_end_to_end_tls: bool + :ivar loaded_certificates: Collection of loaded certificates. + :vartype loaded_certificates: + list[~azure.mgmt.appplatform.v2021_09_01_preview.models.LoadedCertificate] + """ + + _validation = { + 'url': {'readonly': True}, + 'provisioning_state': {'readonly': True}, + 'created_time': {'readonly': True}, + } + + _attribute_map = { + 'public': {'key': 'public', 'type': 'bool'}, + 'url': {'key': 'url', 'type': 'str'}, + 'provisioning_state': {'key': 'provisioningState', 'type': 'str'}, + 'active_deployment_name': {'key': 'activeDeploymentName', 'type': 'str'}, + 'fqdn': {'key': 'fqdn', 'type': 'str'}, + 'https_only': {'key': 'httpsOnly', 'type': 'bool'}, + 'created_time': {'key': 'createdTime', 'type': 'iso-8601'}, + 'temporary_disk': {'key': 'temporaryDisk', 'type': 'TemporaryDisk'}, + 'persistent_disk': {'key': 'persistentDisk', 'type': 'PersistentDisk'}, + 'custom_persistent_disks': {'key': 'customPersistentDisks', 'type': '[CustomPersistentDiskResource]'}, + 'enable_end_to_end_tls': {'key': 'enableEndToEndTLS', 'type': 'bool'}, + 'loaded_certificates': {'key': 'loadedCertificates', 'type': '[LoadedCertificate]'}, + } + + def __init__( + self, + **kwargs + ): + """ + :keyword public: Indicates whether the App exposes public endpoint. + :paramtype public: bool + :keyword active_deployment_name: Name of the active deployment of the App. + :paramtype active_deployment_name: str + :keyword fqdn: Fully qualified dns Name. + :paramtype fqdn: str + :keyword https_only: Indicate if only https is allowed. + :paramtype https_only: bool + :keyword temporary_disk: Temporary disk settings. + :paramtype temporary_disk: ~azure.mgmt.appplatform.v2021_09_01_preview.models.TemporaryDisk + :keyword persistent_disk: Persistent disk settings. + :paramtype persistent_disk: ~azure.mgmt.appplatform.v2021_09_01_preview.models.PersistentDisk + :keyword custom_persistent_disks: List of custom persistent disks. + :paramtype custom_persistent_disks: + list[~azure.mgmt.appplatform.v2021_09_01_preview.models.CustomPersistentDiskResource] + :keyword enable_end_to_end_tls: Indicate if end to end TLS is enabled. + :paramtype enable_end_to_end_tls: bool + :keyword loaded_certificates: Collection of loaded certificates. + :paramtype loaded_certificates: + list[~azure.mgmt.appplatform.v2021_09_01_preview.models.LoadedCertificate] + """ + 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', False) + self.created_time = None + self.temporary_disk = kwargs.get('temporary_disk', None) + self.persistent_disk = kwargs.get('persistent_disk', None) + self.custom_persistent_disks = kwargs.get('custom_persistent_disks', None) + self.enable_end_to_end_tls = kwargs.get('enable_end_to_end_tls', False) + self.loaded_certificates = kwargs.get('loaded_certificates', None) + + +class AvailableOperations(msrest.serialization.Model): + """Available operations of the service. + + :ivar value: Collection of available operation details. + :vartype value: list[~azure.mgmt.appplatform.v2021_09_01_preview.models.OperationDetail] + :ivar next_link: URL client should use to fetch the next page (per server side paging). + It's null for now, added for future use. + :vartype next_link: str + """ + + _attribute_map = { + 'value': {'key': 'value', 'type': '[OperationDetail]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + """ + :keyword value: Collection of available operation details. + :paramtype value: list[~azure.mgmt.appplatform.v2021_09_01_preview.models.OperationDetail] + :keyword next_link: URL client should use to fetch the next page (per server side paging). + It's null for now, added for future use. + :paramtype next_link: str + """ + 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. + + :ivar value: A list of all supported runtime versions. + :vartype value: + list[~azure.mgmt.appplatform.v2021_09_01_preview.models.SupportedRuntimeVersion] + """ + + _validation = { + 'value': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[SupportedRuntimeVersion]'}, + } + + def __init__( + self, + **kwargs + ): + """ + """ + super(AvailableRuntimeVersions, self).__init__(**kwargs) + self.value = None + + +class CustomPersistentDiskProperties(msrest.serialization.Model): + """Custom persistent disk resource payload. + + You probably want to use the sub-classes and not this class directly. Known + sub-classes are: AzureFileVolume. + + All required parameters must be populated in order to send to Azure. + + :ivar type: Required. The type of the underlying resource to mount as a persistent + disk.Constant filled by server. + :vartype type: str + :ivar mount_path: Required. The mount path of the persistent disk. + :vartype mount_path: str + :ivar read_only: Indicates whether the persistent disk is a readOnly one. + :vartype read_only: bool + :ivar mount_options: These are the mount options for a persistent disk. + :vartype mount_options: list[str] + """ + + _validation = { + 'type': {'required': True}, + 'mount_path': {'required': True}, + } + + _attribute_map = { + 'type': {'key': 'type', 'type': 'str'}, + 'mount_path': {'key': 'mountPath', 'type': 'str'}, + 'read_only': {'key': 'readOnly', 'type': 'bool'}, + 'mount_options': {'key': 'mountOptions', 'type': '[str]'}, + } + + _subtype_map = { + 'type': {'AzureFileVolume': 'AzureFileVolume'} + } + + def __init__( + self, + **kwargs + ): + """ + :keyword mount_path: Required. The mount path of the persistent disk. + :paramtype mount_path: str + :keyword read_only: Indicates whether the persistent disk is a readOnly one. + :paramtype read_only: bool + :keyword mount_options: These are the mount options for a persistent disk. + :paramtype mount_options: list[str] + """ + super(CustomPersistentDiskProperties, self).__init__(**kwargs) + self.type = None # type: Optional[str] + self.mount_path = kwargs['mount_path'] + self.read_only = kwargs.get('read_only', None) + self.mount_options = kwargs.get('mount_options', None) + + +class AzureFileVolume(CustomPersistentDiskProperties): + """The properties of the Azure File volume. Azure File shares are mounted as volumes. + + All required parameters must be populated in order to send to Azure. + + :ivar type: Required. The type of the underlying resource to mount as a persistent + disk.Constant filled by server. + :vartype type: str + :ivar mount_path: Required. The mount path of the persistent disk. + :vartype mount_path: str + :ivar read_only: Indicates whether the persistent disk is a readOnly one. + :vartype read_only: bool + :ivar mount_options: These are the mount options for a persistent disk. + :vartype mount_options: list[str] + :ivar share_name: Required. The share name of the Azure File share. + :vartype share_name: str + """ + + _validation = { + 'type': {'required': True}, + 'mount_path': {'required': True}, + 'share_name': {'required': True}, + } + + _attribute_map = { + 'type': {'key': 'type', 'type': 'str'}, + 'mount_path': {'key': 'mountPath', 'type': 'str'}, + 'read_only': {'key': 'readOnly', 'type': 'bool'}, + 'mount_options': {'key': 'mountOptions', 'type': '[str]'}, + 'share_name': {'key': 'shareName', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + """ + :keyword mount_path: Required. The mount path of the persistent disk. + :paramtype mount_path: str + :keyword read_only: Indicates whether the persistent disk is a readOnly one. + :paramtype read_only: bool + :keyword mount_options: These are the mount options for a persistent disk. + :paramtype mount_options: list[str] + :keyword share_name: Required. The share name of the Azure File share. + :paramtype share_name: str + """ + super(AzureFileVolume, self).__init__(**kwargs) + self.type = 'AzureFileVolume' # type: str + self.share_name = kwargs['share_name'] + + +class BindingResource(ProxyResource): + """Binding resource payload. + + 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 + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. + :vartype type: str + :ivar properties: Properties of the Binding resource. + :vartype properties: + ~azure.mgmt.appplatform.v2021_09_01_preview.models.BindingResourceProperties + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'properties': {'key': 'properties', 'type': 'BindingResourceProperties'}, + } + + def __init__( + self, + **kwargs + ): + """ + :keyword properties: Properties of the Binding resource. + :paramtype properties: + ~azure.mgmt.appplatform.v2021_09_01_preview.models.BindingResourceProperties + """ + super(BindingResource, self).__init__(**kwargs) + self.properties = kwargs.get('properties', None) + + +class BindingResourceCollection(msrest.serialization.Model): + """Object that includes an array of Binding resources and a possible link for next set. + + :ivar value: Collection of Binding resources. + :vartype value: list[~azure.mgmt.appplatform.v2021_09_01_preview.models.BindingResource] + :ivar next_link: URL client should use to fetch the next page (per server side paging). + It's null for now, added for future use. + :vartype next_link: str + """ + + _attribute_map = { + 'value': {'key': 'value', 'type': '[BindingResource]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + """ + :keyword value: Collection of Binding resources. + :paramtype value: list[~azure.mgmt.appplatform.v2021_09_01_preview.models.BindingResource] + :keyword next_link: URL client should use to fetch the next page (per server side paging). + It's null for now, added for future use. + :paramtype next_link: str + """ + 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. + + :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. + :vartype resource_type: str + :ivar resource_id: The Azure resource id of the bound resource. + :vartype resource_id: str + :ivar key: The key of the bound resource. + :vartype key: str + :ivar binding_parameters: Binding parameters of the Binding resource. + :vartype 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. + :vartype created_at: str + :ivar updated_at: Update time of the Binding resource. + :vartype updated_at: str + """ + + _validation = { + 'resource_name': {'readonly': True}, + 'resource_type': {'readonly': True}, + 'generated_properties': {'readonly': True}, + 'created_at': {'readonly': True}, + 'updated_at': {'readonly': True}, + } + + _attribute_map = { + 'resource_name': {'key': 'resourceName', 'type': 'str'}, + 'resource_type': {'key': 'resourceType', 'type': 'str'}, + 'resource_id': {'key': 'resourceId', 'type': 'str'}, + 'key': {'key': 'key', 'type': 'str'}, + 'binding_parameters': {'key': 'bindingParameters', 'type': '{object}'}, + 'generated_properties': {'key': 'generatedProperties', 'type': 'str'}, + 'created_at': {'key': 'createdAt', 'type': 'str'}, + 'updated_at': {'key': 'updatedAt', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + """ + :keyword resource_id: The Azure resource id of the bound resource. + :paramtype resource_id: str + :keyword key: The key of the bound resource. + :paramtype key: str + :keyword binding_parameters: Binding parameters of the Binding resource. + :paramtype binding_parameters: dict[str, any] + """ + super(BindingResourceProperties, self).__init__(**kwargs) + self.resource_name = None + self.resource_type = None + self.resource_id = kwargs.get('resource_id', None) + self.key = kwargs.get('key', None) + self.binding_parameters = kwargs.get('binding_parameters', None) + self.generated_properties = None + self.created_at = None + self.updated_at = None + + +class CertificateProperties(msrest.serialization.Model): + """Certificate resource payload. + + You probably want to use the sub-classes and not this class directly. Known + sub-classes are: ContentCertificateProperties, KeyVaultCertificateProperties. + + 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. + + :ivar type: Required. The type of the certificate source.Constant filled by server. + :vartype type: str + :ivar thumbprint: The thumbprint of certificate. + :vartype thumbprint: str + :ivar issuer: The issuer of certificate. + :vartype issuer: str + :ivar issued_date: The issue date of certificate. + :vartype issued_date: str + :ivar expiration_date: The expiration date of certificate. + :vartype expiration_date: str + :ivar activate_date: The activate date of certificate. + :vartype activate_date: str + :ivar subject_name: The subject name of certificate. + :vartype subject_name: str + :ivar dns_names: The domain list of certificate. + :vartype dns_names: list[str] + """ + + _validation = { + 'type': {'required': True}, + 'thumbprint': {'readonly': True}, + 'issuer': {'readonly': True}, + 'issued_date': {'readonly': True}, + 'expiration_date': {'readonly': True}, + 'activate_date': {'readonly': True}, + 'subject_name': {'readonly': True}, + 'dns_names': {'readonly': True}, + } + + _attribute_map = { + 'type': {'key': 'type', 'type': 'str'}, + 'thumbprint': {'key': 'thumbprint', 'type': 'str'}, + 'issuer': {'key': 'issuer', 'type': 'str'}, + 'issued_date': {'key': 'issuedDate', 'type': 'str'}, + 'expiration_date': {'key': 'expirationDate', 'type': 'str'}, + 'activate_date': {'key': 'activateDate', 'type': 'str'}, + 'subject_name': {'key': 'subjectName', 'type': 'str'}, + 'dns_names': {'key': 'dnsNames', 'type': '[str]'}, + } + + _subtype_map = { + 'type': {'ContentCertificate': 'ContentCertificateProperties', 'KeyVaultCertificate': 'KeyVaultCertificateProperties'} + } + + def __init__( + self, + **kwargs + ): + """ + """ + super(CertificateProperties, self).__init__(**kwargs) + self.type = None # type: Optional[str] + self.thumbprint = None + self.issuer = None + self.issued_date = None + self.expiration_date = None + self.activate_date = None + self.subject_name = None + self.dns_names = None + + +class CertificateResource(ProxyResource): + """Certificate resource payload. + + 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 + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. + :vartype type: str + :ivar properties: Properties of the certificate resource payload. + :vartype properties: ~azure.mgmt.appplatform.v2021_09_01_preview.models.CertificateProperties + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'properties': {'key': 'properties', 'type': 'CertificateProperties'}, + } + + def __init__( + self, + **kwargs + ): + """ + :keyword properties: Properties of the certificate resource payload. + :paramtype properties: ~azure.mgmt.appplatform.v2021_09_01_preview.models.CertificateProperties + """ + super(CertificateResource, self).__init__(**kwargs) + self.properties = kwargs.get('properties', None) + + +class CertificateResourceCollection(msrest.serialization.Model): + """Collection compose of certificate resources list and a possible link for next page. + + :ivar value: The certificate resources list. + :vartype value: list[~azure.mgmt.appplatform.v2021_09_01_preview.models.CertificateResource] + :ivar next_link: The link to next page of certificate list. + :vartype next_link: str + """ + + _attribute_map = { + 'value': {'key': 'value', 'type': '[CertificateResource]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + """ + :keyword value: The certificate resources list. + :paramtype value: list[~azure.mgmt.appplatform.v2021_09_01_preview.models.CertificateResource] + :keyword next_link: The link to next page of certificate list. + :paramtype next_link: str + """ + super(CertificateResourceCollection, self).__init__(**kwargs) + self.value = kwargs.get('value', None) + self.next_link = kwargs.get('next_link', None) + + +class CloudErrorBody(msrest.serialization.Model): + """An error response from the service. + + :ivar code: An identifier for the error. Codes are invariant and are intended to be consumed + programmatically. + :vartype code: str + :ivar message: A message describing the error, intended to be suitable for display in a user + interface. + :vartype message: str + :ivar target: The target of the particular error. For example, the name of the property in + error. + :vartype target: str + :ivar details: A list of additional details about the error. + :vartype details: list[~azure.mgmt.appplatform.v2021_09_01_preview.models.CloudErrorBody] + """ + + _attribute_map = { + 'code': {'key': 'code', 'type': 'str'}, + 'message': {'key': 'message', 'type': 'str'}, + 'target': {'key': 'target', 'type': 'str'}, + 'details': {'key': 'details', 'type': '[CloudErrorBody]'}, + } + + def __init__( + self, + **kwargs + ): + """ + :keyword code: An identifier for the error. Codes are invariant and are intended to be consumed + programmatically. + :paramtype code: str + :keyword message: A message describing the error, intended to be suitable for display in a user + interface. + :paramtype message: str + :keyword target: The target of the particular error. For example, the name of the property in + error. + :paramtype target: str + :keyword details: A list of additional details about the error. + :paramtype details: list[~azure.mgmt.appplatform.v2021_09_01_preview.models.CloudErrorBody] + """ + super(CloudErrorBody, self).__init__(**kwargs) + self.code = kwargs.get('code', None) + self.message = kwargs.get('message', None) + self.target = kwargs.get('target', None) + self.details = kwargs.get('details', None) + + +class ClusterResourceProperties(msrest.serialization.Model): + """Service properties payload. + + 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". + :vartype provisioning_state: str or + ~azure.mgmt.appplatform.v2021_09_01_preview.models.ProvisioningState + :ivar network_profile: Network profile of the Service. + :vartype network_profile: ~azure.mgmt.appplatform.v2021_09_01_preview.models.NetworkProfile + :ivar version: Version of the Service. + :vartype version: int + :ivar service_id: ServiceInstanceEntity GUID which uniquely identifies a created resource. + :vartype service_id: str + :ivar power_state: Power state of the Service. Possible values include: "Running", "Stopped". + :vartype power_state: str or ~azure.mgmt.appplatform.v2021_09_01_preview.models.PowerState + """ + + _validation = { + 'provisioning_state': {'readonly': True}, + 'version': {'readonly': True}, + 'service_id': {'readonly': True}, + 'power_state': {'readonly': True}, + } + + _attribute_map = { + 'provisioning_state': {'key': 'provisioningState', 'type': 'str'}, + 'network_profile': {'key': 'networkProfile', 'type': 'NetworkProfile'}, + 'version': {'key': 'version', 'type': 'int'}, + 'service_id': {'key': 'serviceId', 'type': 'str'}, + 'power_state': {'key': 'powerState', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + """ + :keyword network_profile: Network profile of the Service. + :paramtype network_profile: ~azure.mgmt.appplatform.v2021_09_01_preview.models.NetworkProfile + """ + super(ClusterResourceProperties, self).__init__(**kwargs) + self.provisioning_state = None + self.network_profile = kwargs.get('network_profile', None) + self.version = None + self.service_id = None + self.power_state = None + + +class ConfigServerGitProperty(msrest.serialization.Model): + """Property of git. + + All required parameters must be populated in order to send to Azure. + + :ivar repositories: Repositories of git. + :vartype repositories: + list[~azure.mgmt.appplatform.v2021_09_01_preview.models.GitPatternRepository] + :ivar uri: Required. URI of the repository. + :vartype uri: str + :ivar label: Label of the repository. + :vartype label: str + :ivar search_paths: Searching path of the repository. + :vartype search_paths: list[str] + :ivar username: Username of git repository basic auth. + :vartype username: str + :ivar password: Password of git repository basic auth. + :vartype password: str + :ivar host_key: Public sshKey of git repository. + :vartype host_key: str + :ivar host_key_algorithm: SshKey algorithm of git repository. + :vartype host_key_algorithm: str + :ivar private_key: Private sshKey algorithm of git repository. + :vartype private_key: str + :ivar strict_host_key_checking: Strict host key checking or not. + :vartype strict_host_key_checking: bool + """ + + _validation = { + 'uri': {'required': True}, + } + + _attribute_map = { + 'repositories': {'key': 'repositories', 'type': '[GitPatternRepository]'}, + 'uri': {'key': 'uri', 'type': 'str'}, + 'label': {'key': 'label', 'type': 'str'}, + 'search_paths': {'key': 'searchPaths', 'type': '[str]'}, + 'username': {'key': 'username', 'type': 'str'}, + 'password': {'key': 'password', 'type': 'str'}, + 'host_key': {'key': 'hostKey', 'type': 'str'}, + 'host_key_algorithm': {'key': 'hostKeyAlgorithm', 'type': 'str'}, + 'private_key': {'key': 'privateKey', 'type': 'str'}, + 'strict_host_key_checking': {'key': 'strictHostKeyChecking', 'type': 'bool'}, + } + + def __init__( + self, + **kwargs + ): + """ + :keyword repositories: Repositories of git. + :paramtype repositories: + list[~azure.mgmt.appplatform.v2021_09_01_preview.models.GitPatternRepository] + :keyword uri: Required. URI of the repository. + :paramtype uri: str + :keyword label: Label of the repository. + :paramtype label: str + :keyword search_paths: Searching path of the repository. + :paramtype search_paths: list[str] + :keyword username: Username of git repository basic auth. + :paramtype username: str + :keyword password: Password of git repository basic auth. + :paramtype password: str + :keyword host_key: Public sshKey of git repository. + :paramtype host_key: str + :keyword host_key_algorithm: SshKey algorithm of git repository. + :paramtype host_key_algorithm: str + :keyword private_key: Private sshKey algorithm of git repository. + :paramtype private_key: str + :keyword strict_host_key_checking: Strict host key checking or not. + :paramtype strict_host_key_checking: bool + """ + super(ConfigServerGitProperty, self).__init__(**kwargs) + self.repositories = kwargs.get('repositories', 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) + self.password = kwargs.get('password', None) + self.host_key = kwargs.get('host_key', None) + self.host_key_algorithm = kwargs.get('host_key_algorithm', None) + self.private_key = kwargs.get('private_key', None) + self.strict_host_key_checking = kwargs.get('strict_host_key_checking', None) + + +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. + + :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_09_01_preview.models.ConfigServerState + :ivar error: Error when apply config server settings. + :vartype error: ~azure.mgmt.appplatform.v2021_09_01_preview.models.Error + :ivar config_server: Settings of config server. + :vartype config_server: ~azure.mgmt.appplatform.v2021_09_01_preview.models.ConfigServerSettings + """ + + _validation = { + 'provisioning_state': {'readonly': True}, + } + + _attribute_map = { + 'provisioning_state': {'key': 'provisioningState', 'type': 'str'}, + 'error': {'key': 'error', 'type': 'Error'}, + 'config_server': {'key': 'configServer', 'type': 'ConfigServerSettings'}, + } + + def __init__( + self, + **kwargs + ): + """ + :keyword error: Error when apply config server settings. + :paramtype error: ~azure.mgmt.appplatform.v2021_09_01_preview.models.Error + :keyword config_server: Settings of config server. + :paramtype config_server: + ~azure.mgmt.appplatform.v2021_09_01_preview.models.ConfigServerSettings + """ + super(ConfigServerProperties, self).__init__(**kwargs) + self.provisioning_state = None + self.error = kwargs.get('error', None) + self.config_server = kwargs.get('config_server', None) + + +class ConfigServerResource(ProxyResource): + """Config Server resource. + + 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 + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. + :vartype type: str + :ivar properties: Properties of the Config Server resource. + :vartype properties: ~azure.mgmt.appplatform.v2021_09_01_preview.models.ConfigServerProperties + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'properties': {'key': 'properties', 'type': 'ConfigServerProperties'}, + } + + def __init__( + self, + **kwargs + ): + """ + :keyword properties: Properties of the Config Server resource. + :paramtype properties: + ~azure.mgmt.appplatform.v2021_09_01_preview.models.ConfigServerProperties + """ + super(ConfigServerResource, self).__init__(**kwargs) + self.properties = kwargs.get('properties', None) + + +class ConfigServerSettings(msrest.serialization.Model): + """The settings of config server. + + :ivar git_property: Property of git environment. + :vartype git_property: + ~azure.mgmt.appplatform.v2021_09_01_preview.models.ConfigServerGitProperty + """ + + _attribute_map = { + 'git_property': {'key': 'gitProperty', 'type': 'ConfigServerGitProperty'}, + } + + def __init__( + self, + **kwargs + ): + """ + :keyword git_property: Property of git environment. + :paramtype git_property: + ~azure.mgmt.appplatform.v2021_09_01_preview.models.ConfigServerGitProperty + """ + super(ConfigServerSettings, self).__init__(**kwargs) + self.git_property = kwargs.get('git_property', None) + + +class ConfigServerSettingsErrorRecord(msrest.serialization.Model): + """Error record of the config server settings. + + :ivar name: The name of the config server settings error record. + :vartype name: str + :ivar uri: The uri of the config server settings error record. + :vartype uri: str + :ivar messages: The detail error messages of the record. + :vartype messages: list[str] + """ + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'uri': {'key': 'uri', 'type': 'str'}, + 'messages': {'key': 'messages', 'type': '[str]'}, + } + + def __init__( + self, + **kwargs + ): + """ + :keyword name: The name of the config server settings error record. + :paramtype name: str + :keyword uri: The uri of the config server settings error record. + :paramtype uri: str + :keyword messages: The detail error messages of the record. + :paramtype messages: list[str] + """ + 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(msrest.serialization.Model): + """Validation result for config server settings. + + :ivar is_valid: Indicate if the config server settings are valid. + :vartype is_valid: bool + :ivar details: The detail validation results. + :vartype details: + list[~azure.mgmt.appplatform.v2021_09_01_preview.models.ConfigServerSettingsErrorRecord] + """ + + _attribute_map = { + 'is_valid': {'key': 'isValid', 'type': 'bool'}, + 'details': {'key': 'details', 'type': '[ConfigServerSettingsErrorRecord]'}, + } + + def __init__( + self, + **kwargs + ): + """ + :keyword is_valid: Indicate if the config server settings are valid. + :paramtype is_valid: bool + :keyword details: The detail validation results. + :paramtype details: + list[~azure.mgmt.appplatform.v2021_09_01_preview.models.ConfigServerSettingsErrorRecord] + """ + super(ConfigServerSettingsValidateResult, self).__init__(**kwargs) + self.is_valid = kwargs.get('is_valid', None) + self.details = kwargs.get('details', None) + + +class ContentCertificateProperties(CertificateProperties): + """Properties of certificate imported from key vault. + + 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. + + :ivar type: Required. The type of the certificate source.Constant filled by server. + :vartype type: str + :ivar thumbprint: The thumbprint of certificate. + :vartype thumbprint: str + :ivar issuer: The issuer of certificate. + :vartype issuer: str + :ivar issued_date: The issue date of certificate. + :vartype issued_date: str + :ivar expiration_date: The expiration date of certificate. + :vartype expiration_date: str + :ivar activate_date: The activate date of certificate. + :vartype activate_date: str + :ivar subject_name: The subject name of certificate. + :vartype subject_name: str + :ivar dns_names: The domain list of certificate. + :vartype dns_names: list[str] + :ivar content: Required. The content of uploaded certificate. + :vartype content: str + """ + + _validation = { + 'type': {'required': True}, + 'thumbprint': {'readonly': True}, + 'issuer': {'readonly': True}, + 'issued_date': {'readonly': True}, + 'expiration_date': {'readonly': True}, + 'activate_date': {'readonly': True}, + 'subject_name': {'readonly': True}, + 'dns_names': {'readonly': True}, + 'content': {'required': True}, + } + + _attribute_map = { + 'type': {'key': 'type', 'type': 'str'}, + 'thumbprint': {'key': 'thumbprint', 'type': 'str'}, + 'issuer': {'key': 'issuer', 'type': 'str'}, + 'issued_date': {'key': 'issuedDate', 'type': 'str'}, + 'expiration_date': {'key': 'expirationDate', 'type': 'str'}, + 'activate_date': {'key': 'activateDate', 'type': 'str'}, + 'subject_name': {'key': 'subjectName', 'type': 'str'}, + 'dns_names': {'key': 'dnsNames', 'type': '[str]'}, + 'content': {'key': 'content', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + """ + :keyword content: Required. The content of uploaded certificate. + :paramtype content: str + """ + super(ContentCertificateProperties, self).__init__(**kwargs) + self.type = 'ContentCertificate' # type: str + self.content = kwargs['content'] + + +class CustomContainer(msrest.serialization.Model): + """Custom container payload. + + :ivar server: The name of the registry that contains the container image. + :vartype server: str + :ivar container_image: Container image of the custom container. This should be in the form of + :code:``::code:`` without the server name of the registry. + :vartype container_image: str + :ivar command: Entrypoint array. Not executed within a shell. The docker image's ENTRYPOINT is + used if this is not provided. + :vartype command: list[str] + :ivar args: Arguments to the entrypoint. The docker image's CMD is used if this is not + provided. + :vartype args: list[str] + :ivar image_registry_credential: Credential of the image registry. + :vartype image_registry_credential: + ~azure.mgmt.appplatform.v2021_09_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 + ): + """ + :keyword server: The name of the registry that contains the container image. + :paramtype server: str + :keyword container_image: Container image of the custom container. This should be in the form + of :code:``::code:`` without the server name of the registry. + :paramtype container_image: str + :keyword command: Entrypoint array. Not executed within a shell. The docker image's ENTRYPOINT + is used if this is not provided. + :paramtype command: list[str] + :keyword args: Arguments to the entrypoint. The docker image's CMD is used if this is not + provided. + :paramtype args: list[str] + :keyword image_registry_credential: Credential of the image registry. + :paramtype image_registry_credential: + ~azure.mgmt.appplatform.v2021_09_01_preview.models.ImageRegistryCredential + """ + 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. + + :ivar thumbprint: The thumbprint of bound certificate. + :vartype thumbprint: str + :ivar app_name: The app name of domain. + :vartype app_name: str + :ivar cert_name: The bound certificate name of domain. + :vartype cert_name: str + """ + + _validation = { + 'app_name': {'readonly': True}, + } + + _attribute_map = { + 'thumbprint': {'key': 'thumbprint', 'type': 'str'}, + 'app_name': {'key': 'appName', 'type': 'str'}, + 'cert_name': {'key': 'certName', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + """ + :keyword thumbprint: The thumbprint of bound certificate. + :paramtype thumbprint: str + :keyword cert_name: The bound certificate name of domain. + :paramtype cert_name: str + """ + super(CustomDomainProperties, self).__init__(**kwargs) + self.thumbprint = kwargs.get('thumbprint', None) + self.app_name = None + self.cert_name = kwargs.get('cert_name', None) + + +class CustomDomainResource(ProxyResource): + """Custom domain resource payload. + + 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 + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. + :vartype type: str + :ivar properties: Properties of the custom domain resource. + :vartype properties: ~azure.mgmt.appplatform.v2021_09_01_preview.models.CustomDomainProperties + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'properties': {'key': 'properties', 'type': 'CustomDomainProperties'}, + } + + def __init__( + self, + **kwargs + ): + """ + :keyword properties: Properties of the custom domain resource. + :paramtype properties: + ~azure.mgmt.appplatform.v2021_09_01_preview.models.CustomDomainProperties + """ + super(CustomDomainResource, self).__init__(**kwargs) + self.properties = kwargs.get('properties', None) + + +class CustomDomainResourceCollection(msrest.serialization.Model): + """Collection compose of a custom domain resources list and a possible link for next page. + + :ivar value: The custom domain resources list. + :vartype value: list[~azure.mgmt.appplatform.v2021_09_01_preview.models.CustomDomainResource] + :ivar next_link: The link to next page of custom domain list. + :vartype next_link: str + """ + + _attribute_map = { + 'value': {'key': 'value', 'type': '[CustomDomainResource]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + """ + :keyword value: The custom domain resources list. + :paramtype value: list[~azure.mgmt.appplatform.v2021_09_01_preview.models.CustomDomainResource] + :keyword next_link: The link to next page of custom domain list. + :paramtype next_link: str + """ + 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. + + :ivar name: Required. Name to be validated. + :vartype name: str + """ + + _validation = { + 'name': {'required': True}, + } + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + """ + :keyword name: Required. Name to be validated. + :paramtype name: str + """ + super(CustomDomainValidatePayload, self).__init__(**kwargs) + self.name = kwargs['name'] + + +class CustomDomainValidateResult(msrest.serialization.Model): + """Validation result for custom domain. + + :ivar is_valid: Indicates if domain name is valid. + :vartype is_valid: bool + :ivar message: Message of why domain name is invalid. + :vartype message: str + """ + + _attribute_map = { + 'is_valid': {'key': 'isValid', 'type': 'bool'}, + 'message': {'key': 'message', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + """ + :keyword is_valid: Indicates if domain name is valid. + :paramtype is_valid: bool + :keyword message: Message of why domain name is invalid. + :paramtype message: str + """ + super(CustomDomainValidateResult, self).__init__(**kwargs) + self.is_valid = kwargs.get('is_valid', None) + self.message = kwargs.get('message', None) + + +class CustomPersistentDiskResource(msrest.serialization.Model): + """Custom persistent disk resource payload. + + All required parameters must be populated in order to send to Azure. + + :ivar custom_persistent_disk_properties: Properties of the custom persistent disk resource + payload. + :vartype custom_persistent_disk_properties: + ~azure.mgmt.appplatform.v2021_09_01_preview.models.CustomPersistentDiskProperties + :ivar storage_id: Required. The resource id of Azure Spring Cloud Storage resource. + :vartype storage_id: str + """ + + _validation = { + 'storage_id': {'required': True}, + } + + _attribute_map = { + 'custom_persistent_disk_properties': {'key': 'customPersistentDiskProperties', 'type': 'CustomPersistentDiskProperties'}, + 'storage_id': {'key': 'storageId', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + """ + :keyword custom_persistent_disk_properties: Properties of the custom persistent disk resource + payload. + :paramtype custom_persistent_disk_properties: + ~azure.mgmt.appplatform.v2021_09_01_preview.models.CustomPersistentDiskProperties + :keyword storage_id: Required. The resource id of Azure Spring Cloud Storage resource. + :paramtype storage_id: str + """ + super(CustomPersistentDiskResource, self).__init__(**kwargs) + self.custom_persistent_disk_properties = kwargs.get('custom_persistent_disk_properties', None) + self.storage_id = kwargs['storage_id'] + + +class DeploymentInstance(msrest.serialization.Model): + """Deployment instance payload. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar name: Name of the deployment instance. + :vartype name: str + :ivar status: Status of the deployment instance. + :vartype status: str + :ivar reason: Failed reason of the deployment instance. + :vartype reason: str + :ivar discovery_status: Discovery status of the deployment instance. + :vartype discovery_status: str + :ivar start_time: Start time of the deployment instance. + :vartype start_time: str + """ + + _validation = { + 'name': {'readonly': True}, + 'status': {'readonly': True}, + 'reason': {'readonly': True}, + 'discovery_status': {'readonly': True}, + 'start_time': {'readonly': True}, + } + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'status': {'key': 'status', 'type': 'str'}, + 'reason': {'key': 'reason', 'type': 'str'}, + 'discovery_status': {'key': 'discoveryStatus', 'type': 'str'}, + 'start_time': {'key': 'startTime', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + """ + """ + super(DeploymentInstance, self).__init__(**kwargs) + self.name = None + self.status = None + self.reason = None + self.discovery_status = None + self.start_time = None + + +class DeploymentResource(ProxyResource): + """Deployment resource payload. + + 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 + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. + :vartype type: str + :ivar properties: Properties of the Deployment resource. + :vartype properties: + ~azure.mgmt.appplatform.v2021_09_01_preview.models.DeploymentResourceProperties + :ivar sku: Sku of the Deployment resource. + :vartype sku: ~azure.mgmt.appplatform.v2021_09_01_preview.models.Sku + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'properties': {'key': 'properties', 'type': 'DeploymentResourceProperties'}, + 'sku': {'key': 'sku', 'type': 'Sku'}, + } + + def __init__( + self, + **kwargs + ): + """ + :keyword properties: Properties of the Deployment resource. + :paramtype properties: + ~azure.mgmt.appplatform.v2021_09_01_preview.models.DeploymentResourceProperties + :keyword sku: Sku of the Deployment resource. + :paramtype sku: ~azure.mgmt.appplatform.v2021_09_01_preview.models.Sku + """ + super(DeploymentResource, self).__init__(**kwargs) + self.properties = kwargs.get('properties', None) + self.sku = kwargs.get('sku', None) + + +class DeploymentResourceCollection(msrest.serialization.Model): + """Object that includes an array of App resources and a possible link for next set. + + :ivar value: Collection of Deployment resources. + :vartype value: list[~azure.mgmt.appplatform.v2021_09_01_preview.models.DeploymentResource] + :ivar next_link: URL client should use to fetch the next page (per server side paging). + It's null for now, added for future use. + :vartype next_link: str + """ + + _attribute_map = { + 'value': {'key': 'value', 'type': '[DeploymentResource]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + """ + :keyword value: Collection of Deployment resources. + :paramtype value: list[~azure.mgmt.appplatform.v2021_09_01_preview.models.DeploymentResource] + :keyword next_link: URL client should use to fetch the next page (per server side paging). + It's null for now, added for future use. + :paramtype next_link: str + """ + 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. + + :ivar source: Uploaded source information of the deployment. + :vartype source: ~azure.mgmt.appplatform.v2021_09_01_preview.models.UserSourceInfo + :ivar app_name: App name of the deployment. + :vartype app_name: str + :ivar deployment_settings: Deployment settings of the Deployment. + :vartype deployment_settings: + ~azure.mgmt.appplatform.v2021_09_01_preview.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.v2021_09_01_preview.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.v2021_09_01_preview.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.datetime + :ivar instances: Collection of instances belong to the Deployment. + :vartype instances: list[~azure.mgmt.appplatform.v2021_09_01_preview.models.DeploymentInstance] + """ + + _validation = { + 'app_name': {'readonly': True}, + 'provisioning_state': {'readonly': True}, + 'status': {'readonly': True}, + 'active': {'readonly': True}, + 'created_time': {'readonly': True}, + 'instances': {'readonly': True}, + } + + _attribute_map = { + 'source': {'key': 'source', 'type': 'UserSourceInfo'}, + 'app_name': {'key': 'appName', 'type': 'str'}, + 'deployment_settings': {'key': 'deploymentSettings', 'type': 'DeploymentSettings'}, + 'provisioning_state': {'key': 'provisioningState', 'type': 'str'}, + 'status': {'key': 'status', 'type': 'str'}, + 'active': {'key': 'active', 'type': 'bool'}, + 'created_time': {'key': 'createdTime', 'type': 'iso-8601'}, + 'instances': {'key': 'instances', 'type': '[DeploymentInstance]'}, + } + + def __init__( + self, + **kwargs + ): + """ + :keyword source: Uploaded source information of the deployment. + :paramtype source: ~azure.mgmt.appplatform.v2021_09_01_preview.models.UserSourceInfo + :keyword deployment_settings: Deployment settings of the Deployment. + :paramtype deployment_settings: + ~azure.mgmt.appplatform.v2021_09_01_preview.models.DeploymentSettings + """ + super(DeploymentResourceProperties, self).__init__(**kwargs) + self.source = kwargs.get('source', None) + self.app_name = None + self.deployment_settings = kwargs.get('deployment_settings', None) + self.provisioning_state = None + self.status = None + self.active = None + self.created_time = None + self.instances = None + + +class DeploymentSettings(msrest.serialization.Model): + """Deployment settings payload. + + :ivar 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-09-01-preview. Please use the + resourceRequests field to set the CPU size. + :vartype cpu: int + :ivar 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-09-01-preview. Please use the resourceRequests field to set the the memory size. + :vartype memory_in_gb: int + :ivar 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. + :vartype resource_requests: ~azure.mgmt.appplatform.v2021_09_01_preview.models.ResourceRequests + :ivar jvm_options: JVM parameter. + :vartype jvm_options: str + :ivar net_core_main_entry_path: The path to the .NET executable relative to zip root. + :vartype net_core_main_entry_path: str + :ivar environment_variables: Collection of environment variables. + :vartype environment_variables: dict[str, str] + :ivar runtime_version: Runtime version. Possible values include: "Java_8", "Java_11", + "NetCore_31". Default value: "Java_8". + :vartype runtime_version: str or + ~azure.mgmt.appplatform.v2021_09_01_preview.models.RuntimeVersion + :ivar container_probe_settings: Container liveness and readiness probe settings. + :vartype container_probe_settings: + ~azure.mgmt.appplatform.v2021_09_01_preview.models.DeploymentSettingsContainerProbeSettings + """ + + _attribute_map = { + 'cpu': {'key': 'cpu', 'type': 'int'}, + 'memory_in_gb': {'key': 'memoryInGB', 'type': 'int'}, + 'resource_requests': {'key': 'resourceRequests', 'type': 'ResourceRequests'}, + 'jvm_options': {'key': 'jvmOptions', 'type': 'str'}, + 'net_core_main_entry_path': {'key': 'netCoreMainEntryPath', 'type': 'str'}, + 'environment_variables': {'key': 'environmentVariables', 'type': '{str}'}, + 'runtime_version': {'key': 'runtimeVersion', 'type': 'str'}, + 'container_probe_settings': {'key': 'containerProbeSettings', 'type': 'DeploymentSettingsContainerProbeSettings'}, + } + + def __init__( + self, + **kwargs + ): + """ + :keyword 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-09-01-preview. Please use the + resourceRequests field to set the CPU size. + :paramtype cpu: int + :keyword 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-09-01-preview. Please use the resourceRequests field to set the the memory size. + :paramtype memory_in_gb: int + :keyword 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. + :paramtype resource_requests: + ~azure.mgmt.appplatform.v2021_09_01_preview.models.ResourceRequests + :keyword jvm_options: JVM parameter. + :paramtype jvm_options: str + :keyword net_core_main_entry_path: The path to the .NET executable relative to zip root. + :paramtype net_core_main_entry_path: str + :keyword environment_variables: Collection of environment variables. + :paramtype environment_variables: dict[str, str] + :keyword runtime_version: Runtime version. Possible values include: "Java_8", "Java_11", + "NetCore_31". Default value: "Java_8". + :paramtype runtime_version: str or + ~azure.mgmt.appplatform.v2021_09_01_preview.models.RuntimeVersion + :keyword container_probe_settings: Container liveness and readiness probe settings. + :paramtype container_probe_settings: + ~azure.mgmt.appplatform.v2021_09_01_preview.models.DeploymentSettingsContainerProbeSettings + """ + super(DeploymentSettings, self).__init__(**kwargs) + self.cpu = kwargs.get('cpu', 1) + self.memory_in_gb = kwargs.get('memory_in_gb', 1) + self.resource_requests = kwargs.get('resource_requests', None) + 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', "Java_8") + self.container_probe_settings = kwargs.get('container_probe_settings', None) + + +class DeploymentSettingsContainerProbeSettings(msrest.serialization.Model): + """Container liveness and readiness probe settings. + + :ivar disable_probe: Indicates whether disable the liveness and readiness probe. + :vartype disable_probe: bool + """ + + _attribute_map = { + 'disable_probe': {'key': 'disableProbe', 'type': 'bool'}, + } + + def __init__( + self, + **kwargs + ): + """ + :keyword disable_probe: Indicates whether disable the liveness and readiness probe. + :paramtype disable_probe: bool + """ + super(DeploymentSettingsContainerProbeSettings, self).__init__(**kwargs) + self.disable_probe = kwargs.get('disable_probe', None) + + +class DiagnosticParameters(msrest.serialization.Model): + """Diagnostic parameters of diagnostic operations. + + :ivar app_instance: App instance name. + :vartype app_instance: str + :ivar file_path: Your target file path in your own BYOS. + :vartype file_path: str + :ivar duration: Duration of your JFR. 1 min can be represented by 1m or 60s. + :vartype duration: str + """ + + _attribute_map = { + 'app_instance': {'key': 'appInstance', 'type': 'str'}, + 'file_path': {'key': 'filePath', 'type': 'str'}, + 'duration': {'key': 'duration', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + """ + :keyword app_instance: App instance name. + :paramtype app_instance: str + :keyword file_path: Your target file path in your own BYOS. + :paramtype file_path: str + :keyword duration: Duration of your JFR. 1 min can be represented by 1m or 60s. + :paramtype duration: str + """ + super(DiagnosticParameters, self).__init__(**kwargs) + self.app_instance = kwargs.get('app_instance', None) + self.file_path = kwargs.get('file_path', None) + self.duration = kwargs.get('duration', None) + + +class Error(msrest.serialization.Model): + """The error code compose of code and message. + + :ivar code: The code of error. + :vartype code: str + :ivar message: The message of error. + :vartype message: str + """ + + _attribute_map = { + 'code': {'key': 'code', 'type': 'str'}, + 'message': {'key': 'message', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + """ + :keyword code: The code of error. + :paramtype code: str + :keyword message: The message of error. + :paramtype message: str + """ + super(Error, self).__init__(**kwargs) + self.code = kwargs.get('code', None) + self.message = kwargs.get('message', None) + + +class GitPatternRepository(msrest.serialization.Model): + """Git repository property payload. + + All required parameters must be populated in order to send to Azure. + + :ivar name: Required. Name of the repository. + :vartype name: str + :ivar pattern: Collection of pattern of the repository. + :vartype pattern: list[str] + :ivar uri: Required. URI of the repository. + :vartype uri: str + :ivar label: Label of the repository. + :vartype label: str + :ivar search_paths: Searching path of the repository. + :vartype search_paths: list[str] + :ivar username: Username of git repository basic auth. + :vartype username: str + :ivar password: Password of git repository basic auth. + :vartype password: str + :ivar host_key: Public sshKey of git repository. + :vartype host_key: str + :ivar host_key_algorithm: SshKey algorithm of git repository. + :vartype host_key_algorithm: str + :ivar private_key: Private sshKey algorithm of git repository. + :vartype private_key: str + :ivar strict_host_key_checking: Strict host key checking or not. + :vartype strict_host_key_checking: bool + """ + + _validation = { + 'name': {'required': True}, + 'uri': {'required': True}, + } + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'pattern': {'key': 'pattern', 'type': '[str]'}, + 'uri': {'key': 'uri', 'type': 'str'}, + 'label': {'key': 'label', 'type': 'str'}, + 'search_paths': {'key': 'searchPaths', 'type': '[str]'}, + 'username': {'key': 'username', 'type': 'str'}, + 'password': {'key': 'password', 'type': 'str'}, + 'host_key': {'key': 'hostKey', 'type': 'str'}, + 'host_key_algorithm': {'key': 'hostKeyAlgorithm', 'type': 'str'}, + 'private_key': {'key': 'privateKey', 'type': 'str'}, + 'strict_host_key_checking': {'key': 'strictHostKeyChecking', 'type': 'bool'}, + } + + def __init__( + self, + **kwargs + ): + """ + :keyword name: Required. Name of the repository. + :paramtype name: str + :keyword pattern: Collection of pattern of the repository. + :paramtype pattern: list[str] + :keyword uri: Required. URI of the repository. + :paramtype uri: str + :keyword label: Label of the repository. + :paramtype label: str + :keyword search_paths: Searching path of the repository. + :paramtype search_paths: list[str] + :keyword username: Username of git repository basic auth. + :paramtype username: str + :keyword password: Password of git repository basic auth. + :paramtype password: str + :keyword host_key: Public sshKey of git repository. + :paramtype host_key: str + :keyword host_key_algorithm: SshKey algorithm of git repository. + :paramtype host_key_algorithm: str + :keyword private_key: Private sshKey algorithm of git repository. + :paramtype private_key: str + :keyword strict_host_key_checking: Strict host key checking or not. + :paramtype strict_host_key_checking: bool + """ + super(GitPatternRepository, self).__init__(**kwargs) + self.name = kwargs['name'] + self.pattern = kwargs.get('pattern', 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) + self.password = kwargs.get('password', None) + self.host_key = kwargs.get('host_key', None) + self.host_key_algorithm = kwargs.get('host_key_algorithm', None) + self.private_key = kwargs.get('private_key', None) + self.strict_host_key_checking = kwargs.get('strict_host_key_checking', None) + + +class ImageRegistryCredential(msrest.serialization.Model): + """Credential of the image registry. + + :ivar username: The username of the image registry credential. + :vartype username: str + :ivar password: The password of the image registry credential. + :vartype password: str + """ + + _attribute_map = { + 'username': {'key': 'username', 'type': 'str'}, + 'password': {'key': 'password', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + """ + :keyword username: The username of the image registry credential. + :paramtype username: str + :keyword password: The password of the image registry credential. + :paramtype password: str + """ + super(ImageRegistryCredential, self).__init__(**kwargs) + self.username = kwargs.get('username', None) + self.password = kwargs.get('password', None) + + +class KeyVaultCertificateProperties(CertificateProperties): + """Properties of certificate imported from key vault. + + 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. + + :ivar type: Required. The type of the certificate source.Constant filled by server. + :vartype type: str + :ivar thumbprint: The thumbprint of certificate. + :vartype thumbprint: str + :ivar issuer: The issuer of certificate. + :vartype issuer: str + :ivar issued_date: The issue date of certificate. + :vartype issued_date: str + :ivar expiration_date: The expiration date of certificate. + :vartype expiration_date: str + :ivar activate_date: The activate date of certificate. + :vartype activate_date: str + :ivar subject_name: The subject name of certificate. + :vartype subject_name: str + :ivar dns_names: The domain list of certificate. + :vartype dns_names: list[str] + :ivar vault_uri: Required. The vault uri of user key vault. + :vartype vault_uri: str + :ivar key_vault_cert_name: Required. The certificate name of key vault. + :vartype key_vault_cert_name: str + :ivar cert_version: The certificate version of key vault. + :vartype cert_version: str + :ivar exclude_private_key: Optional. If set to true, it will not import private key from key + vault. + :vartype exclude_private_key: bool + """ + + _validation = { + 'type': {'required': True}, + 'thumbprint': {'readonly': True}, + 'issuer': {'readonly': True}, + 'issued_date': {'readonly': True}, + 'expiration_date': {'readonly': True}, + 'activate_date': {'readonly': True}, + 'subject_name': {'readonly': True}, + 'dns_names': {'readonly': True}, + 'vault_uri': {'required': True}, + 'key_vault_cert_name': {'required': True}, + } + + _attribute_map = { + 'type': {'key': 'type', 'type': 'str'}, + 'thumbprint': {'key': 'thumbprint', 'type': 'str'}, + 'issuer': {'key': 'issuer', 'type': 'str'}, + 'issued_date': {'key': 'issuedDate', 'type': 'str'}, + 'expiration_date': {'key': 'expirationDate', 'type': 'str'}, + 'activate_date': {'key': 'activateDate', 'type': 'str'}, + 'subject_name': {'key': 'subjectName', 'type': 'str'}, + 'dns_names': {'key': 'dnsNames', 'type': '[str]'}, + 'vault_uri': {'key': 'vaultUri', 'type': 'str'}, + 'key_vault_cert_name': {'key': 'keyVaultCertName', 'type': 'str'}, + 'cert_version': {'key': 'certVersion', 'type': 'str'}, + 'exclude_private_key': {'key': 'excludePrivateKey', 'type': 'bool'}, + } + + def __init__( + self, + **kwargs + ): + """ + :keyword vault_uri: Required. The vault uri of user key vault. + :paramtype vault_uri: str + :keyword key_vault_cert_name: Required. The certificate name of key vault. + :paramtype key_vault_cert_name: str + :keyword cert_version: The certificate version of key vault. + :paramtype cert_version: str + :keyword exclude_private_key: Optional. If set to true, it will not import private key from key + vault. + :paramtype exclude_private_key: bool + """ + super(KeyVaultCertificateProperties, self).__init__(**kwargs) + self.type = 'KeyVaultCertificate' # type: str + 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.exclude_private_key = kwargs.get('exclude_private_key', False) + + +class LoadedCertificate(msrest.serialization.Model): + """Loaded certificate payload. + + All required parameters must be populated in order to send to Azure. + + :ivar resource_id: Required. Resource Id of loaded certificate. + :vartype resource_id: str + :ivar load_trust_store: Indicate whether the certificate will be loaded into default trust + store, only work for Java runtime. + :vartype load_trust_store: bool + """ + + _validation = { + 'resource_id': {'required': True}, + } + + _attribute_map = { + 'resource_id': {'key': 'resourceId', 'type': 'str'}, + 'load_trust_store': {'key': 'loadTrustStore', 'type': 'bool'}, + } + + def __init__( + self, + **kwargs + ): + """ + :keyword resource_id: Required. Resource Id of loaded certificate. + :paramtype resource_id: str + :keyword load_trust_store: Indicate whether the certificate will be loaded into default trust + store, only work for Java runtime. + :paramtype load_trust_store: bool + """ + super(LoadedCertificate, self).__init__(**kwargs) + self.resource_id = kwargs['resource_id'] + self.load_trust_store = kwargs.get('load_trust_store', False) + + +class LogFileUrlResponse(msrest.serialization.Model): + """Log file URL payload. + + All required parameters must be populated in order to send to Azure. + + :ivar url: Required. URL of the log file. + :vartype url: str + """ + + _validation = { + 'url': {'required': True}, + } + + _attribute_map = { + 'url': {'key': 'url', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + """ + :keyword url: Required. URL of the log file. + :paramtype url: str + """ + super(LogFileUrlResponse, self).__init__(**kwargs) + self.url = kwargs['url'] + + +class LogSpecification(msrest.serialization.Model): + """Specifications of the Log for Azure Monitoring. + + :ivar name: Name of the log. + :vartype name: str + :ivar display_name: Localized friendly display name of the log. + :vartype display_name: str + :ivar blob_duration: Blob duration of the log. + :vartype blob_duration: str + """ + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'display_name': {'key': 'displayName', 'type': 'str'}, + 'blob_duration': {'key': 'blobDuration', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + """ + :keyword name: Name of the log. + :paramtype name: str + :keyword display_name: Localized friendly display name of the log. + :paramtype display_name: str + :keyword blob_duration: Blob duration of the log. + :paramtype blob_duration: str + """ + 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(msrest.serialization.Model): + """Managed identity properties retrieved from ARM request headers. + + :ivar type: Type of the managed identity. Possible values include: "None", "SystemAssigned", + "UserAssigned", "SystemAssigned,UserAssigned". + :vartype type: str or ~azure.mgmt.appplatform.v2021_09_01_preview.models.ManagedIdentityType + :ivar principal_id: Principal Id. + :vartype principal_id: str + :ivar tenant_id: Tenant Id. + :vartype tenant_id: str + """ + + _attribute_map = { + 'type': {'key': 'type', 'type': 'str'}, + 'principal_id': {'key': 'principalId', 'type': 'str'}, + 'tenant_id': {'key': 'tenantId', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + """ + :keyword type: Type of the managed identity. Possible values include: "None", "SystemAssigned", + "UserAssigned", "SystemAssigned,UserAssigned". + :paramtype type: str or ~azure.mgmt.appplatform.v2021_09_01_preview.models.ManagedIdentityType + :keyword principal_id: Principal Id. + :paramtype principal_id: str + :keyword tenant_id: Tenant Id. + :paramtype tenant_id: str + """ + 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(msrest.serialization.Model): + """Specifications of the Dimension of metrics. + + :ivar name: Name of the dimension. + :vartype name: str + :ivar display_name: Localized friendly display name of the dimension. + :vartype display_name: str + :ivar to_be_exported_for_shoebox: Whether this dimension should be included for the Shoebox + export scenario. + :vartype 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 + ): + """ + :keyword name: Name of the dimension. + :paramtype name: str + :keyword display_name: Localized friendly display name of the dimension. + :paramtype display_name: str + :keyword to_be_exported_for_shoebox: Whether this dimension should be included for the Shoebox + export scenario. + :paramtype to_be_exported_for_shoebox: bool + """ + 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(msrest.serialization.Model): + """Specifications of the Metrics for Azure Monitoring. + + :ivar name: Name of the metric. + :vartype name: str + :ivar display_name: Localized friendly display name of the metric. + :vartype display_name: str + :ivar display_description: Localized friendly description of the metric. + :vartype display_description: str + :ivar unit: Unit that makes sense for the metric. + :vartype unit: str + :ivar category: Name of the metric category that the metric belongs to. A metric can only + belong to a single category. + :vartype category: str + :ivar aggregation_type: Only provide one value for this field. Valid values: Average, Minimum, + Maximum, Total, Count. + :vartype aggregation_type: str + :ivar supported_aggregation_types: Supported aggregation types. + :vartype supported_aggregation_types: list[str] + :ivar supported_time_grain_types: Supported time grain types. + :vartype supported_time_grain_types: list[str] + :ivar fill_gap_with_zero: Optional. If set to true, then zero will be returned for time + duration where no metric is emitted/published. + :vartype fill_gap_with_zero: bool + :ivar dimensions: Dimensions of the metric. + :vartype dimensions: list[~azure.mgmt.appplatform.v2021_09_01_preview.models.MetricDimension] + :ivar source_mdm_namespace: Name of the MDM namespace. Optional. + :vartype source_mdm_namespace: str + """ + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'display_name': {'key': 'displayName', 'type': 'str'}, + 'display_description': {'key': 'displayDescription', 'type': 'str'}, + 'unit': {'key': 'unit', 'type': 'str'}, + 'category': {'key': 'category', 'type': 'str'}, + 'aggregation_type': {'key': 'aggregationType', 'type': 'str'}, + 'supported_aggregation_types': {'key': 'supportedAggregationTypes', 'type': '[str]'}, + 'supported_time_grain_types': {'key': 'supportedTimeGrainTypes', 'type': '[str]'}, + 'fill_gap_with_zero': {'key': 'fillGapWithZero', 'type': 'bool'}, + 'dimensions': {'key': 'dimensions', 'type': '[MetricDimension]'}, + 'source_mdm_namespace': {'key': 'sourceMdmNamespace', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + """ + :keyword name: Name of the metric. + :paramtype name: str + :keyword display_name: Localized friendly display name of the metric. + :paramtype display_name: str + :keyword display_description: Localized friendly description of the metric. + :paramtype display_description: str + :keyword unit: Unit that makes sense for the metric. + :paramtype unit: str + :keyword category: Name of the metric category that the metric belongs to. A metric can only + belong to a single category. + :paramtype category: str + :keyword aggregation_type: Only provide one value for this field. Valid values: Average, + Minimum, Maximum, Total, Count. + :paramtype aggregation_type: str + :keyword supported_aggregation_types: Supported aggregation types. + :paramtype supported_aggregation_types: list[str] + :keyword supported_time_grain_types: Supported time grain types. + :paramtype supported_time_grain_types: list[str] + :keyword fill_gap_with_zero: Optional. If set to true, then zero will be returned for time + duration where no metric is emitted/published. + :paramtype fill_gap_with_zero: bool + :keyword dimensions: Dimensions of the metric. + :paramtype dimensions: list[~azure.mgmt.appplatform.v2021_09_01_preview.models.MetricDimension] + :keyword source_mdm_namespace: Name of the MDM namespace. Optional. + :paramtype source_mdm_namespace: str + """ + super(MetricSpecification, self).__init__(**kwargs) + self.name = kwargs.get('name', None) + self.display_name = kwargs.get('display_name', None) + self.display_description = kwargs.get('display_description', None) + self.unit = kwargs.get('unit', None) + self.category = kwargs.get('category', None) + self.aggregation_type = kwargs.get('aggregation_type', None) + self.supported_aggregation_types = kwargs.get('supported_aggregation_types', None) + self.supported_time_grain_types = kwargs.get('supported_time_grain_types', None) + self.fill_gap_with_zero = kwargs.get('fill_gap_with_zero', None) + self.dimensions = kwargs.get('dimensions', None) + self.source_mdm_namespace = kwargs.get('source_mdm_namespace', None) + + +class MonitoringSettingProperties(msrest.serialization.Model): + """Monitoring Setting properties payload. + + 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". + :vartype provisioning_state: str or + ~azure.mgmt.appplatform.v2021_09_01_preview.models.MonitoringSettingState + :ivar error: Error when apply Monitoring Setting changes. + :vartype error: ~azure.mgmt.appplatform.v2021_09_01_preview.models.Error + :ivar 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. + :vartype trace_enabled: bool + :ivar app_insights_instrumentation_key: Target application insight instrumentation key, null or + whitespace include empty will disable monitoringSettings. + :vartype app_insights_instrumentation_key: str + :ivar app_insights_sampling_rate: Indicates the sampling rate of application insight agent, + should be in range [0.0, 100.0]. + :vartype app_insights_sampling_rate: float + :ivar app_insights_agent_versions: Indicates the versions of application insight agent. + :vartype app_insights_agent_versions: + ~azure.mgmt.appplatform.v2021_09_01_preview.models.ApplicationInsightsAgentVersions + """ + + _validation = { + 'provisioning_state': {'readonly': True}, + 'app_insights_sampling_rate': {'maximum': 100, 'minimum': 0}, + } + + _attribute_map = { + 'provisioning_state': {'key': 'provisioningState', 'type': 'str'}, + 'error': {'key': 'error', 'type': 'Error'}, + 'trace_enabled': {'key': 'traceEnabled', 'type': 'bool'}, + 'app_insights_instrumentation_key': {'key': 'appInsightsInstrumentationKey', 'type': 'str'}, + 'app_insights_sampling_rate': {'key': 'appInsightsSamplingRate', 'type': 'float'}, + 'app_insights_agent_versions': {'key': 'appInsightsAgentVersions', 'type': 'ApplicationInsightsAgentVersions'}, + } + + def __init__( + self, + **kwargs + ): + """ + :keyword error: Error when apply Monitoring Setting changes. + :paramtype error: ~azure.mgmt.appplatform.v2021_09_01_preview.models.Error + :keyword 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. + :paramtype trace_enabled: bool + :keyword app_insights_instrumentation_key: Target application insight instrumentation key, null + or whitespace include empty will disable monitoringSettings. + :paramtype app_insights_instrumentation_key: str + :keyword app_insights_sampling_rate: Indicates the sampling rate of application insight agent, + should be in range [0.0, 100.0]. + :paramtype app_insights_sampling_rate: float + :keyword app_insights_agent_versions: Indicates the versions of application insight agent. + :paramtype app_insights_agent_versions: + ~azure.mgmt.appplatform.v2021_09_01_preview.models.ApplicationInsightsAgentVersions + """ + super(MonitoringSettingProperties, self).__init__(**kwargs) + self.provisioning_state = None + self.error = kwargs.get('error', None) + self.trace_enabled = kwargs.get('trace_enabled', None) + self.app_insights_instrumentation_key = kwargs.get('app_insights_instrumentation_key', None) + self.app_insights_sampling_rate = kwargs.get('app_insights_sampling_rate', None) + self.app_insights_agent_versions = kwargs.get('app_insights_agent_versions', None) + + +class MonitoringSettingResource(ProxyResource): + """Monitoring Setting resource. + + 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 + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. + :vartype type: str + :ivar properties: Properties of the Monitoring Setting resource. + :vartype properties: + ~azure.mgmt.appplatform.v2021_09_01_preview.models.MonitoringSettingProperties + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'properties': {'key': 'properties', 'type': 'MonitoringSettingProperties'}, + } + + def __init__( + self, + **kwargs + ): + """ + :keyword properties: Properties of the Monitoring Setting resource. + :paramtype properties: + ~azure.mgmt.appplatform.v2021_09_01_preview.models.MonitoringSettingProperties + """ + super(MonitoringSettingResource, self).__init__(**kwargs) + self.properties = kwargs.get('properties', None) + + +class NameAvailability(msrest.serialization.Model): + """Name availability result payload. + + :ivar name_available: Indicates whether the name is available. + :vartype name_available: bool + :ivar reason: Reason why the name is not available. + :vartype reason: str + :ivar message: Message why the name is not available. + :vartype message: str + """ + + _attribute_map = { + 'name_available': {'key': 'nameAvailable', 'type': 'bool'}, + 'reason': {'key': 'reason', 'type': 'str'}, + 'message': {'key': 'message', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + """ + :keyword name_available: Indicates whether the name is available. + :paramtype name_available: bool + :keyword reason: Reason why the name is not available. + :paramtype reason: str + :keyword message: Message why the name is not available. + :paramtype message: str + """ + 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(msrest.serialization.Model): + """Name availability parameters payload. + + All required parameters must be populated in order to send to Azure. + + :ivar type: Required. Type of the resource to check name availability. + :vartype type: str + :ivar name: Required. Name to be checked. + :vartype name: str + """ + + _validation = { + 'type': {'required': True}, + 'name': {'required': True}, + } + + _attribute_map = { + 'type': {'key': 'type', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + """ + :keyword type: Required. Type of the resource to check name availability. + :paramtype type: str + :keyword name: Required. Name to be checked. + :paramtype name: str + """ + super(NameAvailabilityParameters, self).__init__(**kwargs) + self.type = kwargs['type'] + self.name = kwargs['name'] + + +class NetworkProfile(msrest.serialization.Model): + """Service network profile payload. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar service_runtime_subnet_id: Fully qualified resource Id of the subnet to host Azure Spring + Cloud Service Runtime. + :vartype service_runtime_subnet_id: str + :ivar app_subnet_id: Fully qualified resource Id of the subnet to host Azure Spring Cloud Apps. + :vartype app_subnet_id: str + :ivar service_cidr: Azure Spring Cloud service reserved CIDR. + :vartype service_cidr: str + :ivar service_runtime_network_resource_group: Name of the resource group containing network + resources of Azure Spring Cloud Service Runtime. + :vartype service_runtime_network_resource_group: str + :ivar app_network_resource_group: Name of the resource group containing network resources of + Azure Spring Cloud Apps. + :vartype app_network_resource_group: str + :ivar outbound_i_ps: Desired outbound IP resources for Azure Spring Cloud instance. + :vartype outbound_i_ps: + ~azure.mgmt.appplatform.v2021_09_01_preview.models.NetworkProfileOutboundIPs + :ivar required_traffics: Required inbound or outbound traffics for Azure Spring Cloud instance. + :vartype required_traffics: + list[~azure.mgmt.appplatform.v2021_09_01_preview.models.RequiredTraffic] + """ + + _validation = { + 'outbound_i_ps': {'readonly': True}, + 'required_traffics': {'readonly': True}, + } + + _attribute_map = { + 'service_runtime_subnet_id': {'key': 'serviceRuntimeSubnetId', 'type': 'str'}, + 'app_subnet_id': {'key': 'appSubnetId', 'type': 'str'}, + 'service_cidr': {'key': 'serviceCidr', 'type': 'str'}, + 'service_runtime_network_resource_group': {'key': 'serviceRuntimeNetworkResourceGroup', 'type': 'str'}, + 'app_network_resource_group': {'key': 'appNetworkResourceGroup', 'type': 'str'}, + 'outbound_i_ps': {'key': 'outboundIPs', 'type': 'NetworkProfileOutboundIPs'}, + 'required_traffics': {'key': 'requiredTraffics', 'type': '[RequiredTraffic]'}, + } + + def __init__( + self, + **kwargs + ): + """ + :keyword service_runtime_subnet_id: Fully qualified resource Id of the subnet to host Azure + Spring Cloud Service Runtime. + :paramtype service_runtime_subnet_id: str + :keyword app_subnet_id: Fully qualified resource Id of the subnet to host Azure Spring Cloud + Apps. + :paramtype app_subnet_id: str + :keyword service_cidr: Azure Spring Cloud service reserved CIDR. + :paramtype service_cidr: str + :keyword service_runtime_network_resource_group: Name of the resource group containing network + resources of Azure Spring Cloud Service Runtime. + :paramtype service_runtime_network_resource_group: str + :keyword app_network_resource_group: Name of the resource group containing network resources of + Azure Spring Cloud Apps. + :paramtype app_network_resource_group: str + """ + 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_i_ps = None + self.required_traffics = None + + +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. + + :ivar public_i_ps: A list of public IP addresses. + :vartype public_i_ps: list[str] + """ + + _validation = { + 'public_i_ps': {'readonly': True}, + } + + _attribute_map = { + 'public_i_ps': {'key': 'publicIPs', 'type': '[str]'}, + } + + def __init__( + self, + **kwargs + ): + """ + """ + super(NetworkProfileOutboundIPs, self).__init__(**kwargs) + self.public_i_ps = None + + +class OperationDetail(msrest.serialization.Model): + """Operation detail payload. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar name: Name of the operation. + :vartype name: str + :ivar is_data_action: Indicates whether the operation is a data action. + :vartype is_data_action: bool + :ivar display: Display of the operation. + :vartype display: ~azure.mgmt.appplatform.v2021_09_01_preview.models.OperationDisplay + :ivar action_type: Enum. Indicates the action type. "Internal" refers to actions that are for + internal only APIs. Possible values include: "Internal". + :vartype action_type: str or ~azure.mgmt.appplatform.v2021_09_01_preview.models.ActionType + :ivar origin: Origin of the operation. + :vartype origin: str + :ivar properties: Properties of the operation. + :vartype properties: ~azure.mgmt.appplatform.v2021_09_01_preview.models.OperationProperties + """ + + _validation = { + 'action_type': {'readonly': True}, + } + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'is_data_action': {'key': 'isDataAction', 'type': 'bool'}, + 'display': {'key': 'display', 'type': 'OperationDisplay'}, + 'action_type': {'key': 'actionType', 'type': 'str'}, + 'origin': {'key': 'origin', 'type': 'str'}, + 'properties': {'key': 'properties', 'type': 'OperationProperties'}, + } + + def __init__( + self, + **kwargs + ): + """ + :keyword name: Name of the operation. + :paramtype name: str + :keyword is_data_action: Indicates whether the operation is a data action. + :paramtype is_data_action: bool + :keyword display: Display of the operation. + :paramtype display: ~azure.mgmt.appplatform.v2021_09_01_preview.models.OperationDisplay + :keyword origin: Origin of the operation. + :paramtype origin: str + :keyword properties: Properties of the operation. + :paramtype properties: ~azure.mgmt.appplatform.v2021_09_01_preview.models.OperationProperties + """ + super(OperationDetail, self).__init__(**kwargs) + self.name = kwargs.get('name', None) + self.is_data_action = kwargs.get('is_data_action', None) + self.display = kwargs.get('display', None) + self.action_type = None + self.origin = kwargs.get('origin', None) + self.properties = kwargs.get('properties', None) + + +class OperationDisplay(msrest.serialization.Model): + """Operation display payload. + + :ivar provider: Resource provider of the operation. + :vartype provider: str + :ivar resource: Resource of the operation. + :vartype resource: str + :ivar operation: Localized friendly name for the operation. + :vartype operation: str + :ivar description: Localized friendly description for the operation. + :vartype description: str + """ + + _attribute_map = { + 'provider': {'key': 'provider', 'type': 'str'}, + 'resource': {'key': 'resource', 'type': 'str'}, + 'operation': {'key': 'operation', 'type': 'str'}, + 'description': {'key': 'description', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + """ + :keyword provider: Resource provider of the operation. + :paramtype provider: str + :keyword resource: Resource of the operation. + :paramtype resource: str + :keyword operation: Localized friendly name for the operation. + :paramtype operation: str + :keyword description: Localized friendly description for the operation. + :paramtype description: str + """ + super(OperationDisplay, self).__init__(**kwargs) + self.provider = kwargs.get('provider', None) + self.resource = kwargs.get('resource', None) + self.operation = kwargs.get('operation', None) + self.description = kwargs.get('description', None) + + +class OperationProperties(msrest.serialization.Model): + """Extra Operation properties. + + :ivar service_specification: Service specifications of the operation. + :vartype service_specification: + ~azure.mgmt.appplatform.v2021_09_01_preview.models.ServiceSpecification + """ + + _attribute_map = { + 'service_specification': {'key': 'serviceSpecification', 'type': 'ServiceSpecification'}, + } + + def __init__( + self, + **kwargs + ): + """ + :keyword service_specification: Service specifications of the operation. + :paramtype service_specification: + ~azure.mgmt.appplatform.v2021_09_01_preview.models.ServiceSpecification + """ + super(OperationProperties, self).__init__(**kwargs) + self.service_specification = kwargs.get('service_specification', None) + + +class PersistentDisk(msrest.serialization.Model): + """Persistent disk payload. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar size_in_gb: Size of the persistent disk in GB. + :vartype size_in_gb: int + :ivar used_in_gb: Size of the used persistent disk in GB. + :vartype used_in_gb: int + :ivar mount_path: Mount path of the persistent disk. + :vartype mount_path: str + """ + + _validation = { + 'size_in_gb': {'maximum': 50, 'minimum': 0}, + 'used_in_gb': {'readonly': True, 'maximum': 50, 'minimum': 0}, + } + + _attribute_map = { + 'size_in_gb': {'key': 'sizeInGB', 'type': 'int'}, + 'used_in_gb': {'key': 'usedInGB', 'type': 'int'}, + 'mount_path': {'key': 'mountPath', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + """ + :keyword size_in_gb: Size of the persistent disk in GB. + :paramtype size_in_gb: int + :keyword mount_path: Mount path of the persistent disk. + :paramtype mount_path: str + """ + 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(msrest.serialization.Model): + """Regenerate test key request payload. + + All required parameters must be populated in order to send to Azure. + + :ivar key_type: Required. Type of the test key. Possible values include: "Primary", + "Secondary". + :vartype key_type: str or ~azure.mgmt.appplatform.v2021_09_01_preview.models.TestKeyType + """ + + _validation = { + 'key_type': {'required': True}, + } + + _attribute_map = { + 'key_type': {'key': 'keyType', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + """ + :keyword key_type: Required. Type of the test key. Possible values include: "Primary", + "Secondary". + :paramtype key_type: str or ~azure.mgmt.appplatform.v2021_09_01_preview.models.TestKeyType + """ + super(RegenerateTestKeyRequestPayload, self).__init__(**kwargs) + self.key_type = kwargs['key_type'] + + +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. + + :ivar protocol: The protocol of required traffic. + :vartype protocol: str + :ivar port: The port of required traffic. + :vartype port: int + :ivar ips: The ip list of required traffic. + :vartype ips: list[str] + :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_09_01_preview.models.TrafficDirection + """ + + _validation = { + 'protocol': {'readonly': True}, + 'port': {'readonly': True}, + 'ips': {'readonly': True}, + 'fqdns': {'readonly': True}, + 'direction': {'readonly': True}, + } + + _attribute_map = { + 'protocol': {'key': 'protocol', 'type': 'str'}, + 'port': {'key': 'port', 'type': 'int'}, + 'ips': {'key': 'ips', 'type': '[str]'}, + 'fqdns': {'key': 'fqdns', 'type': '[str]'}, + 'direction': {'key': 'direction', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + """ + """ + super(RequiredTraffic, self).__init__(**kwargs) + self.protocol = None + self.port = None + self.ips = None + self.fqdns = None + self.direction = None + + +class ResourceRequests(msrest.serialization.Model): + """Deployment resource request payload. + + :ivar 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. + :vartype cpu: str + :ivar 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. + :vartype memory: str + """ + + _attribute_map = { + 'cpu': {'key': 'cpu', 'type': 'str'}, + 'memory': {'key': 'memory', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + """ + :keyword 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. + :paramtype cpu: str + :keyword 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. + :paramtype memory: str + """ + super(ResourceRequests, self).__init__(**kwargs) + self.cpu = kwargs.get('cpu', None) + self.memory = kwargs.get('memory', None) + + +class ResourceSku(msrest.serialization.Model): + """Describes an available Azure Spring Cloud SKU. + + :ivar resource_type: Gets the type of resource the SKU applies to. + :vartype resource_type: str + :ivar name: Gets the name of SKU. + :vartype name: str + :ivar tier: Gets the tier of SKU. + :vartype tier: str + :ivar capacity: Gets the capacity of SKU. + :vartype capacity: ~azure.mgmt.appplatform.v2021_09_01_preview.models.SkuCapacity + :ivar locations: Gets the set of locations that the SKU is available. + :vartype locations: list[str] + :ivar location_info: Gets a list of locations and availability zones in those locations where + the SKU is available. + :vartype location_info: + list[~azure.mgmt.appplatform.v2021_09_01_preview.models.ResourceSkuLocationInfo] + :ivar restrictions: Gets the restrictions because of which SKU cannot be used. This is + empty if there are no restrictions. + :vartype restrictions: + list[~azure.mgmt.appplatform.v2021_09_01_preview.models.ResourceSkuRestrictions] + """ + + _attribute_map = { + 'resource_type': {'key': 'resourceType', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'tier': {'key': 'tier', 'type': 'str'}, + 'capacity': {'key': 'capacity', 'type': 'SkuCapacity'}, + 'locations': {'key': 'locations', 'type': '[str]'}, + 'location_info': {'key': 'locationInfo', 'type': '[ResourceSkuLocationInfo]'}, + 'restrictions': {'key': 'restrictions', 'type': '[ResourceSkuRestrictions]'}, + } + + def __init__( + self, + **kwargs + ): + """ + :keyword resource_type: Gets the type of resource the SKU applies to. + :paramtype resource_type: str + :keyword name: Gets the name of SKU. + :paramtype name: str + :keyword tier: Gets the tier of SKU. + :paramtype tier: str + :keyword capacity: Gets the capacity of SKU. + :paramtype capacity: ~azure.mgmt.appplatform.v2021_09_01_preview.models.SkuCapacity + :keyword locations: Gets the set of locations that the SKU is available. + :paramtype locations: list[str] + :keyword location_info: Gets a list of locations and availability zones in those locations + where the SKU is available. + :paramtype location_info: + list[~azure.mgmt.appplatform.v2021_09_01_preview.models.ResourceSkuLocationInfo] + :keyword restrictions: Gets the restrictions because of which SKU cannot be used. This is + empty if there are no restrictions. + :paramtype restrictions: + list[~azure.mgmt.appplatform.v2021_09_01_preview.models.ResourceSkuRestrictions] + """ + super(ResourceSku, self).__init__(**kwargs) + self.resource_type = kwargs.get('resource_type', None) + self.name = kwargs.get('name', None) + self.tier = kwargs.get('tier', None) + self.capacity = kwargs.get('capacity', None) + self.locations = kwargs.get('locations', None) + self.location_info = kwargs.get('location_info', None) + self.restrictions = kwargs.get('restrictions', None) + + +class ResourceSkuCapabilities(msrest.serialization.Model): + """ResourceSkuCapabilities. + + :ivar name: Gets an invariant to describe the feature. + :vartype name: str + :ivar value: Gets an invariant if the feature is measured by quantity. + :vartype value: str + """ + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'value': {'key': 'value', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + """ + :keyword name: Gets an invariant to describe the feature. + :paramtype name: str + :keyword value: Gets an invariant if the feature is measured by quantity. + :paramtype value: str + """ + super(ResourceSkuCapabilities, self).__init__(**kwargs) + self.name = kwargs.get('name', None) + self.value = kwargs.get('value', None) + + +class ResourceSkuCollection(msrest.serialization.Model): + """Object that includes an array of Azure Spring Cloud SKU and a possible link for next set. + + :ivar value: Collection of resource SKU. + :vartype value: list[~azure.mgmt.appplatform.v2021_09_01_preview.models.ResourceSku] + :ivar next_link: URL client should use to fetch the next page (per server side paging). + It's null for now, added for future use. + :vartype next_link: str + """ + + _attribute_map = { + 'value': {'key': 'value', 'type': '[ResourceSku]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + """ + :keyword value: Collection of resource SKU. + :paramtype value: list[~azure.mgmt.appplatform.v2021_09_01_preview.models.ResourceSku] + :keyword next_link: URL client should use to fetch the next page (per server side paging). + It's null for now, added for future use. + :paramtype next_link: str + """ + 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. + + :ivar location: Gets location of the SKU. + :vartype location: str + :ivar zones: Gets list of availability zones where the SKU is supported. + :vartype zones: list[str] + :ivar zone_details: Gets details of capabilities available to a SKU in specific zones. + :vartype zone_details: + list[~azure.mgmt.appplatform.v2021_09_01_preview.models.ResourceSkuZoneDetails] + """ + + _attribute_map = { + 'location': {'key': 'location', 'type': 'str'}, + 'zones': {'key': 'zones', 'type': '[str]'}, + 'zone_details': {'key': 'zoneDetails', 'type': '[ResourceSkuZoneDetails]'}, + } + + def __init__( + self, + **kwargs + ): + """ + :keyword location: Gets location of the SKU. + :paramtype location: str + :keyword zones: Gets list of availability zones where the SKU is supported. + :paramtype zones: list[str] + :keyword zone_details: Gets details of capabilities available to a SKU in specific zones. + :paramtype zone_details: + list[~azure.mgmt.appplatform.v2021_09_01_preview.models.ResourceSkuZoneDetails] + """ + 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(msrest.serialization.Model): + """Information about the restriction where the SKU cannot be used. + + :ivar locations: Gets locations where the SKU is restricted. + :vartype locations: list[str] + :ivar zones: Gets list of availability zones where the SKU is restricted. + :vartype zones: list[str] + """ + + _attribute_map = { + 'locations': {'key': 'locations', 'type': '[str]'}, + 'zones': {'key': 'zones', 'type': '[str]'}, + } + + def __init__( + self, + **kwargs + ): + """ + :keyword locations: Gets locations where the SKU is restricted. + :paramtype locations: list[str] + :keyword zones: Gets list of availability zones where the SKU is restricted. + :paramtype zones: list[str] + """ + super(ResourceSkuRestrictionInfo, self).__init__(**kwargs) + self.locations = kwargs.get('locations', None) + self.zones = kwargs.get('zones', None) + + +class ResourceSkuRestrictions(msrest.serialization.Model): + """Restrictions where the SKU cannot be used. + + :ivar type: Gets the type of restrictions. Possible values include: 'Location', 'Zone'. + Possible values include: "Location", "Zone". + :vartype type: str or + ~azure.mgmt.appplatform.v2021_09_01_preview.models.ResourceSkuRestrictionsType + :ivar values: Gets the value of restrictions. If the restriction type is set to + location. This would be different locations where the SKU is restricted. + :vartype values: list[str] + :ivar restriction_info: Gets the information about the restriction where the SKU cannot be + used. + :vartype restriction_info: + ~azure.mgmt.appplatform.v2021_09_01_preview.models.ResourceSkuRestrictionInfo + :ivar reason_code: Gets the reason for restriction. Possible values include: 'QuotaId', + 'NotAvailableForSubscription'. Possible values include: "QuotaId", + "NotAvailableForSubscription". + :vartype reason_code: str or + ~azure.mgmt.appplatform.v2021_09_01_preview.models.ResourceSkuRestrictionsReasonCode + """ + + _attribute_map = { + 'type': {'key': 'type', 'type': 'str'}, + 'values': {'key': 'values', 'type': '[str]'}, + 'restriction_info': {'key': 'restrictionInfo', 'type': 'ResourceSkuRestrictionInfo'}, + 'reason_code': {'key': 'reasonCode', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + """ + :keyword type: Gets the type of restrictions. Possible values include: 'Location', 'Zone'. + Possible values include: "Location", "Zone". + :paramtype type: str or + ~azure.mgmt.appplatform.v2021_09_01_preview.models.ResourceSkuRestrictionsType + :keyword values: Gets the value of restrictions. If the restriction type is set to + location. This would be different locations where the SKU is restricted. + :paramtype values: list[str] + :keyword restriction_info: Gets the information about the restriction where the SKU cannot be + used. + :paramtype restriction_info: + ~azure.mgmt.appplatform.v2021_09_01_preview.models.ResourceSkuRestrictionInfo + :keyword reason_code: Gets the reason for restriction. Possible values include: 'QuotaId', + 'NotAvailableForSubscription'. Possible values include: "QuotaId", + "NotAvailableForSubscription". + :paramtype reason_code: str or + ~azure.mgmt.appplatform.v2021_09_01_preview.models.ResourceSkuRestrictionsReasonCode + """ + super(ResourceSkuRestrictions, self).__init__(**kwargs) + self.type = kwargs.get('type', None) + self.values = kwargs.get('values', None) + self.restriction_info = kwargs.get('restriction_info', None) + self.reason_code = kwargs.get('reason_code', None) + + +class ResourceSkuZoneDetails(msrest.serialization.Model): + """Details of capabilities available to a SKU in specific zones. + + :ivar name: Gets the set of zones that the SKU is available in with the + specified capabilities. + :vartype name: list[str] + :ivar capabilities: Gets a list of capabilities that are available for the SKU in the + specified list of zones. + :vartype capabilities: + list[~azure.mgmt.appplatform.v2021_09_01_preview.models.ResourceSkuCapabilities] + """ + + _attribute_map = { + 'name': {'key': 'name', 'type': '[str]'}, + 'capabilities': {'key': 'capabilities', 'type': '[ResourceSkuCapabilities]'}, + } + + def __init__( + self, + **kwargs + ): + """ + :keyword name: Gets the set of zones that the SKU is available in with the + specified capabilities. + :paramtype name: list[str] + :keyword capabilities: Gets a list of capabilities that are available for the SKU in the + specified list of zones. + :paramtype capabilities: + list[~azure.mgmt.appplatform.v2021_09_01_preview.models.ResourceSkuCapabilities] + """ + super(ResourceSkuZoneDetails, self).__init__(**kwargs) + self.name = kwargs.get('name', None) + self.capabilities = kwargs.get('capabilities', None) + + +class ResourceUploadDefinition(msrest.serialization.Model): + """Resource upload definition payload. + + :ivar relative_path: Source relative path. + :vartype relative_path: str + :ivar upload_url: Upload URL. + :vartype upload_url: str + """ + + _attribute_map = { + 'relative_path': {'key': 'relativePath', 'type': 'str'}, + 'upload_url': {'key': 'uploadUrl', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + """ + :keyword relative_path: Source relative path. + :paramtype relative_path: str + :keyword upload_url: Upload URL. + :paramtype upload_url: str + """ + super(ResourceUploadDefinition, self).__init__(**kwargs) + self.relative_path = kwargs.get('relative_path', None) + self.upload_url = kwargs.get('upload_url', None) + + +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. + + :ivar id: Fully qualified resource Id for the resource. + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. + :vartype type: str + :ivar location: The GEO location of the resource. + :vartype location: str + :ivar tags: A set of tags. Tags of the service which is a list of key value pairs that describe + the resource. + :vartype tags: dict[str, str] + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'location': {'key': 'location', 'type': 'str'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + } + + def __init__( + self, + **kwargs + ): + """ + :keyword location: The GEO location of the resource. + :paramtype location: str + :keyword tags: A set of tags. Tags of the service which is a list of key value pairs that + describe the resource. + :paramtype tags: dict[str, str] + """ + super(TrackedResource, self).__init__(**kwargs) + self.location = kwargs.get('location', None) + self.tags = kwargs.get('tags', None) + + +class ServiceResource(TrackedResource): + """Service resource. + + 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 + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. + :vartype type: str + :ivar location: The GEO location of the resource. + :vartype location: str + :ivar tags: A set of tags. Tags of the service which is a list of key value pairs that describe + the resource. + :vartype tags: dict[str, str] + :ivar properties: Properties of the Service resource. + :vartype properties: + ~azure.mgmt.appplatform.v2021_09_01_preview.models.ClusterResourceProperties + :ivar sku: Sku of the Service resource. + :vartype sku: ~azure.mgmt.appplatform.v2021_09_01_preview.models.Sku + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'location': {'key': 'location', 'type': 'str'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + 'properties': {'key': 'properties', 'type': 'ClusterResourceProperties'}, + 'sku': {'key': 'sku', 'type': 'Sku'}, + } + + def __init__( + self, + **kwargs + ): + """ + :keyword location: The GEO location of the resource. + :paramtype location: str + :keyword tags: A set of tags. Tags of the service which is a list of key value pairs that + describe the resource. + :paramtype tags: dict[str, str] + :keyword properties: Properties of the Service resource. + :paramtype properties: + ~azure.mgmt.appplatform.v2021_09_01_preview.models.ClusterResourceProperties + :keyword sku: Sku of the Service resource. + :paramtype sku: ~azure.mgmt.appplatform.v2021_09_01_preview.models.Sku + """ + super(ServiceResource, self).__init__(**kwargs) + self.properties = kwargs.get('properties', None) + self.sku = kwargs.get('sku', None) + + +class ServiceResourceList(msrest.serialization.Model): + """Object that includes an array of Service resources and a possible link for next set. + + :ivar value: Collection of Service resources. + :vartype value: list[~azure.mgmt.appplatform.v2021_09_01_preview.models.ServiceResource] + :ivar next_link: URL client should use to fetch the next page (per server side paging). + It's null for now, added for future use. + :vartype next_link: str + """ + + _attribute_map = { + 'value': {'key': 'value', 'type': '[ServiceResource]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + """ + :keyword value: Collection of Service resources. + :paramtype value: list[~azure.mgmt.appplatform.v2021_09_01_preview.models.ServiceResource] + :keyword next_link: URL client should use to fetch the next page (per server side paging). + It's null for now, added for future use. + :paramtype next_link: str + """ + 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. + + :ivar log_specifications: Specifications of the Log for Azure Monitoring. + :vartype log_specifications: + list[~azure.mgmt.appplatform.v2021_09_01_preview.models.LogSpecification] + :ivar metric_specifications: Specifications of the Metrics for Azure Monitoring. + :vartype metric_specifications: + list[~azure.mgmt.appplatform.v2021_09_01_preview.models.MetricSpecification] + """ + + _attribute_map = { + 'log_specifications': {'key': 'logSpecifications', 'type': '[LogSpecification]'}, + 'metric_specifications': {'key': 'metricSpecifications', 'type': '[MetricSpecification]'}, + } + + def __init__( + self, + **kwargs + ): + """ + :keyword log_specifications: Specifications of the Log for Azure Monitoring. + :paramtype log_specifications: + list[~azure.mgmt.appplatform.v2021_09_01_preview.models.LogSpecification] + :keyword metric_specifications: Specifications of the Metrics for Azure Monitoring. + :paramtype metric_specifications: + list[~azure.mgmt.appplatform.v2021_09_01_preview.models.MetricSpecification] + """ + super(ServiceSpecification, self).__init__(**kwargs) + self.log_specifications = kwargs.get('log_specifications', None) + self.metric_specifications = kwargs.get('metric_specifications', None) + + +class Sku(msrest.serialization.Model): + """Sku of Azure Spring Cloud. + + :ivar name: Name of the Sku. + :vartype name: str + :ivar tier: Tier of the Sku. + :vartype tier: str + :ivar capacity: Current capacity of the target resource. + :vartype capacity: int + """ + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'tier': {'key': 'tier', 'type': 'str'}, + 'capacity': {'key': 'capacity', 'type': 'int'}, + } + + def __init__( + self, + **kwargs + ): + """ + :keyword name: Name of the Sku. + :paramtype name: str + :keyword tier: Tier of the Sku. + :paramtype tier: str + :keyword capacity: Current capacity of the target resource. + :paramtype capacity: int + """ + 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(msrest.serialization.Model): + """The SKU capacity. + + All required parameters must be populated in order to send to Azure. + + :ivar minimum: Required. Gets or sets the minimum. + :vartype minimum: int + :ivar maximum: Gets or sets the maximum. + :vartype maximum: int + :ivar default: Gets or sets the default. + :vartype default: int + :ivar scale_type: Gets or sets the type of the scale. Possible values include: "None", + "Manual", "Automatic". + :vartype scale_type: str or ~azure.mgmt.appplatform.v2021_09_01_preview.models.SkuScaleType + """ + + _validation = { + 'minimum': {'required': True}, + } + + _attribute_map = { + 'minimum': {'key': 'minimum', 'type': 'int'}, + 'maximum': {'key': 'maximum', 'type': 'int'}, + 'default': {'key': 'default', 'type': 'int'}, + 'scale_type': {'key': 'scaleType', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + """ + :keyword minimum: Required. Gets or sets the minimum. + :paramtype minimum: int + :keyword maximum: Gets or sets the maximum. + :paramtype maximum: int + :keyword default: Gets or sets the default. + :paramtype default: int + :keyword scale_type: Gets or sets the type of the scale. Possible values include: "None", + "Manual", "Automatic". + :paramtype scale_type: str or ~azure.mgmt.appplatform.v2021_09_01_preview.models.SkuScaleType + """ + super(SkuCapacity, self).__init__(**kwargs) + 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 StorageProperties(msrest.serialization.Model): + """Storage resource payload. + + You probably want to use the sub-classes and not this class directly. Known + sub-classes are: StorageAccount. + + All required parameters must be populated in order to send to Azure. + + :ivar storage_type: Required. The type of the storage.Constant filled by server. + :vartype storage_type: str + """ + + _validation = { + 'storage_type': {'required': True}, + } + + _attribute_map = { + 'storage_type': {'key': 'storageType', 'type': 'str'}, + } + + _subtype_map = { + 'storage_type': {'StorageAccount': 'StorageAccount'} + } + + def __init__( + self, + **kwargs + ): + """ + """ + super(StorageProperties, self).__init__(**kwargs) + self.storage_type = None # type: Optional[str] + + +class StorageAccount(StorageProperties): + """storage resource of type Azure Storage Account. + + All required parameters must be populated in order to send to Azure. + + :ivar storage_type: Required. The type of the storage.Constant filled by server. + :vartype storage_type: str + :ivar account_name: Required. The account name of the Azure Storage Account. + :vartype account_name: str + :ivar account_key: Required. The account key of the Azure Storage Account. + :vartype account_key: str + """ + + _validation = { + 'storage_type': {'required': True}, + 'account_name': {'required': True}, + 'account_key': {'required': True}, + } + + _attribute_map = { + 'storage_type': {'key': 'storageType', 'type': 'str'}, + 'account_name': {'key': 'accountName', 'type': 'str'}, + 'account_key': {'key': 'accountKey', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + """ + :keyword account_name: Required. The account name of the Azure Storage Account. + :paramtype account_name: str + :keyword account_key: Required. The account key of the Azure Storage Account. + :paramtype account_key: str + """ + super(StorageAccount, self).__init__(**kwargs) + self.storage_type = 'StorageAccount' # type: str + self.account_name = kwargs['account_name'] + self.account_key = kwargs['account_key'] + + +class StorageResource(ProxyResource): + """Storage resource payload. + + 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 + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. + :vartype type: str + :ivar properties: Properties of the storage resource payload. + :vartype properties: ~azure.mgmt.appplatform.v2021_09_01_preview.models.StorageProperties + :ivar system_data: Metadata pertaining to creation and last modification of the resource. + :vartype system_data: ~azure.mgmt.appplatform.v2021_09_01_preview.models.SystemData + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'system_data': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'properties': {'key': 'properties', 'type': 'StorageProperties'}, + 'system_data': {'key': 'systemData', 'type': 'SystemData'}, + } + + def __init__( + self, + **kwargs + ): + """ + :keyword properties: Properties of the storage resource payload. + :paramtype properties: ~azure.mgmt.appplatform.v2021_09_01_preview.models.StorageProperties + """ + super(StorageResource, self).__init__(**kwargs) + self.properties = kwargs.get('properties', None) + self.system_data = None + + +class StorageResourceCollection(msrest.serialization.Model): + """Collection compose of storage resources list and a possible link for next page. + + :ivar value: The storage resources list. + :vartype value: list[~azure.mgmt.appplatform.v2021_09_01_preview.models.StorageResource] + :ivar next_link: The link to next page of storage list. + :vartype next_link: str + """ + + _attribute_map = { + 'value': {'key': 'value', 'type': '[StorageResource]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + """ + :keyword value: The storage resources list. + :paramtype value: list[~azure.mgmt.appplatform.v2021_09_01_preview.models.StorageResource] + :keyword next_link: The link to next page of storage list. + :paramtype next_link: str + """ + super(StorageResourceCollection, self).__init__(**kwargs) + self.value = kwargs.get('value', None) + self.next_link = kwargs.get('next_link', None) + + +class SupportedRuntimeVersion(msrest.serialization.Model): + """Supported deployment runtime version descriptor. + + :ivar value: The raw value which could be passed to deployment CRUD operations. Possible values + include: "Java_8", "Java_11", "NetCore_31". + :vartype value: str or ~azure.mgmt.appplatform.v2021_09_01_preview.models.SupportedRuntimeValue + :ivar platform: The platform of this runtime version (possible values: "Java" or ".NET"). + Possible values include: "Java", ".NET Core". + :vartype platform: str or + ~azure.mgmt.appplatform.v2021_09_01_preview.models.SupportedRuntimePlatform + :ivar version: The detailed version (major.minor) of the platform. + :vartype version: str + """ + + _attribute_map = { + 'value': {'key': 'value', 'type': 'str'}, + 'platform': {'key': 'platform', 'type': 'str'}, + 'version': {'key': 'version', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + """ + :keyword value: The raw value which could be passed to deployment CRUD operations. Possible + values include: "Java_8", "Java_11", "NetCore_31". + :paramtype value: str or + ~azure.mgmt.appplatform.v2021_09_01_preview.models.SupportedRuntimeValue + :keyword platform: The platform of this runtime version (possible values: "Java" or ".NET"). + Possible values include: "Java", ".NET Core". + :paramtype platform: str or + ~azure.mgmt.appplatform.v2021_09_01_preview.models.SupportedRuntimePlatform + :keyword version: The detailed version (major.minor) of the platform. + :paramtype version: str + """ + super(SupportedRuntimeVersion, self).__init__(**kwargs) + self.value = kwargs.get('value', None) + self.platform = kwargs.get('platform', None) + self.version = kwargs.get('version', None) + + +class SystemData(msrest.serialization.Model): + """Metadata pertaining to creation and last modification of the resource. + + :ivar created_by: The identity that created the resource. + :vartype created_by: str + :ivar created_by_type: The type of identity that created the resource. Possible values include: + "User", "Application", "ManagedIdentity", "Key". + :vartype created_by_type: str or + ~azure.mgmt.appplatform.v2021_09_01_preview.models.CreatedByType + :ivar created_at: The timestamp of resource creation (UTC). + :vartype created_at: ~datetime.datetime + :ivar last_modified_by: The identity that last modified the resource. + :vartype last_modified_by: str + :ivar last_modified_by_type: The type of identity that last modified the resource. Possible + values include: "User", "Application", "ManagedIdentity", "Key". + :vartype last_modified_by_type: str or + ~azure.mgmt.appplatform.v2021_09_01_preview.models.CreatedByType + :ivar last_modified_at: The timestamp of resource last modification (UTC). + :vartype last_modified_at: ~datetime.datetime + """ + + _attribute_map = { + 'created_by': {'key': 'createdBy', 'type': 'str'}, + 'created_by_type': {'key': 'createdByType', 'type': 'str'}, + 'created_at': {'key': 'createdAt', 'type': 'iso-8601'}, + 'last_modified_by': {'key': 'lastModifiedBy', 'type': 'str'}, + 'last_modified_by_type': {'key': 'lastModifiedByType', 'type': 'str'}, + 'last_modified_at': {'key': 'lastModifiedAt', 'type': 'iso-8601'}, + } + + def __init__( + self, + **kwargs + ): + """ + :keyword created_by: The identity that created the resource. + :paramtype created_by: str + :keyword created_by_type: The type of identity that created the resource. Possible values + include: "User", "Application", "ManagedIdentity", "Key". + :paramtype created_by_type: str or + ~azure.mgmt.appplatform.v2021_09_01_preview.models.CreatedByType + :keyword created_at: The timestamp of resource creation (UTC). + :paramtype created_at: ~datetime.datetime + :keyword last_modified_by: The identity that last modified the resource. + :paramtype last_modified_by: str + :keyword last_modified_by_type: The type of identity that last modified the resource. Possible + values include: "User", "Application", "ManagedIdentity", "Key". + :paramtype last_modified_by_type: str or + ~azure.mgmt.appplatform.v2021_09_01_preview.models.CreatedByType + :keyword last_modified_at: The timestamp of resource last modification (UTC). + :paramtype last_modified_at: ~datetime.datetime + """ + super(SystemData, self).__init__(**kwargs) + self.created_by = kwargs.get('created_by', None) + self.created_by_type = kwargs.get('created_by_type', None) + self.created_at = kwargs.get('created_at', None) + self.last_modified_by = kwargs.get('last_modified_by', None) + self.last_modified_by_type = kwargs.get('last_modified_by_type', None) + self.last_modified_at = kwargs.get('last_modified_at', None) + + +class TemporaryDisk(msrest.serialization.Model): + """Temporary disk payload. + + :ivar size_in_gb: Size of the temporary disk in GB. + :vartype size_in_gb: int + :ivar mount_path: Mount path of the temporary disk. + :vartype mount_path: str + """ + + _validation = { + 'size_in_gb': {'maximum': 5, 'minimum': 0}, + } + + _attribute_map = { + 'size_in_gb': {'key': 'sizeInGB', 'type': 'int'}, + 'mount_path': {'key': 'mountPath', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + """ + :keyword size_in_gb: Size of the temporary disk in GB. + :paramtype size_in_gb: int + :keyword mount_path: Mount path of the temporary disk. + :paramtype mount_path: str + """ + super(TemporaryDisk, self).__init__(**kwargs) + self.size_in_gb = kwargs.get('size_in_gb', None) + self.mount_path = kwargs.get('mount_path', "/tmp") + + +class TestKeys(msrest.serialization.Model): + """Test keys payload. + + :ivar primary_key: Primary key. + :vartype primary_key: str + :ivar secondary_key: Secondary key. + :vartype secondary_key: str + :ivar primary_test_endpoint: Primary test endpoint. + :vartype primary_test_endpoint: str + :ivar secondary_test_endpoint: Secondary test endpoint. + :vartype secondary_test_endpoint: str + :ivar enabled: Indicates whether the test endpoint feature enabled or not. + :vartype enabled: bool + """ + + _attribute_map = { + 'primary_key': {'key': 'primaryKey', 'type': 'str'}, + 'secondary_key': {'key': 'secondaryKey', 'type': 'str'}, + 'primary_test_endpoint': {'key': 'primaryTestEndpoint', 'type': 'str'}, + 'secondary_test_endpoint': {'key': 'secondaryTestEndpoint', 'type': 'str'}, + 'enabled': {'key': 'enabled', 'type': 'bool'}, + } + + def __init__( + self, + **kwargs + ): + """ + :keyword primary_key: Primary key. + :paramtype primary_key: str + :keyword secondary_key: Secondary key. + :paramtype secondary_key: str + :keyword primary_test_endpoint: Primary test endpoint. + :paramtype primary_test_endpoint: str + :keyword secondary_test_endpoint: Secondary test endpoint. + :paramtype secondary_test_endpoint: str + :keyword enabled: Indicates whether the test endpoint feature enabled or not. + :paramtype enabled: bool + """ + super(TestKeys, self).__init__(**kwargs) + self.primary_key = kwargs.get('primary_key', None) + self.secondary_key = kwargs.get('secondary_key', None) + self.primary_test_endpoint = kwargs.get('primary_test_endpoint', None) + self.secondary_test_endpoint = kwargs.get('secondary_test_endpoint', None) + self.enabled = kwargs.get('enabled', None) + + +class UserSourceInfo(msrest.serialization.Model): + """Source information for a deployment. + + :ivar type: Type of the source uploaded. Possible values include: "Jar", "NetCoreZip", + "Source", "Container". + :vartype type: str or ~azure.mgmt.appplatform.v2021_09_01_preview.models.UserSourceType + :ivar relative_path: Relative path of the storage which stores the source. + :vartype relative_path: str + :ivar version: Version of the source. + :vartype version: str + :ivar 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. + :vartype artifact_selector: str + :ivar custom_container: Custom container payload. + :vartype custom_container: ~azure.mgmt.appplatform.v2021_09_01_preview.models.CustomContainer + """ + + _attribute_map = { + 'type': {'key': 'type', 'type': 'str'}, + '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 + ): + """ + :keyword type: Type of the source uploaded. Possible values include: "Jar", "NetCoreZip", + "Source", "Container". + :paramtype type: str or ~azure.mgmt.appplatform.v2021_09_01_preview.models.UserSourceType + :keyword relative_path: Relative path of the storage which stores the source. + :paramtype relative_path: str + :keyword version: Version of the source. + :paramtype version: str + :keyword 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. + :paramtype artifact_selector: str + :keyword custom_container: Custom container payload. + :paramtype custom_container: ~azure.mgmt.appplatform.v2021_09_01_preview.models.CustomContainer + """ + 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/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2021_09_01_preview/models/_models_py3.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2021_09_01_preview/models/_models_py3.py new file mode 100644 index 0000000000000..0295a580f3012 --- /dev/null +++ b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2021_09_01_preview/models/_models_py3.py @@ -0,0 +1,4072 @@ +# 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. +# -------------------------------------------------------------------------- + +import datetime +from typing import Any, Dict, List, Optional, Union + +import msrest.serialization + +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. + + :ivar java: Indicates the version of application insight java agent. + :vartype java: str + """ + + _validation = { + 'java': {'readonly': True}, + } + + _attribute_map = { + 'java': {'key': 'java', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + """ + """ + super(ApplicationInsightsAgentVersions, self).__init__(**kwargs) + self.java = None + + +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. + + :ivar id: Fully qualified resource Id for the resource. + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. + :vartype type: str + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + """ + """ + super(Resource, self).__init__(**kwargs) + self.id = None + self.name = None + self.type = None + + +class ProxyResource(Resource): + """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. + + :ivar id: Fully qualified resource Id for the resource. + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. + :vartype type: str + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + } + + 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. + + :ivar id: Fully qualified resource Id for the resource. + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. + :vartype type: str + :ivar properties: Properties of the App resource. + :vartype properties: ~azure.mgmt.appplatform.v2021_09_01_preview.models.AppResourceProperties + :ivar identity: The Managed Identity type of the app resource. + :vartype identity: ~azure.mgmt.appplatform.v2021_09_01_preview.models.ManagedIdentityProperties + :ivar location: The GEO location of the application, always the same with its parent resource. + :vartype location: str + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'properties': {'key': 'properties', 'type': 'AppResourceProperties'}, + 'identity': {'key': 'identity', 'type': 'ManagedIdentityProperties'}, + 'location': {'key': 'location', 'type': 'str'}, + } + + def __init__( + self, + *, + properties: Optional["AppResourceProperties"] = None, + identity: Optional["ManagedIdentityProperties"] = None, + location: Optional[str] = None, + **kwargs + ): + """ + :keyword properties: Properties of the App resource. + :paramtype properties: ~azure.mgmt.appplatform.v2021_09_01_preview.models.AppResourceProperties + :keyword identity: The Managed Identity type of the app resource. + :paramtype identity: + ~azure.mgmt.appplatform.v2021_09_01_preview.models.ManagedIdentityProperties + :keyword location: The GEO location of the application, always the same with its parent + resource. + :paramtype location: str + """ + super(AppResource, self).__init__(**kwargs) + self.properties = properties + self.identity = identity + self.location = location + + +class AppResourceCollection(msrest.serialization.Model): + """Object that includes an array of App resources and a possible link for next set. + + :ivar value: Collection of App resources. + :vartype value: list[~azure.mgmt.appplatform.v2021_09_01_preview.models.AppResource] + :ivar next_link: URL client should use to fetch the next page (per server side paging). + It's null for now, added for future use. + :vartype 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 + ): + """ + :keyword value: Collection of App resources. + :paramtype value: list[~azure.mgmt.appplatform.v2021_09_01_preview.models.AppResource] + :keyword next_link: URL client should use to fetch the next page (per server side paging). + It's null for now, added for future use. + :paramtype next_link: str + """ + 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. + + :ivar public: Indicates whether the App exposes public endpoint. + :vartype public: bool + :ivar url: URL of the App. + :vartype url: str + :ivar provisioning_state: Provisioning state of the App. Possible values include: "Succeeded", + "Failed", "Creating", "Updating". + :vartype provisioning_state: str or + ~azure.mgmt.appplatform.v2021_09_01_preview.models.AppResourceProvisioningState + :ivar active_deployment_name: Name of the active deployment of the App. + :vartype active_deployment_name: str + :ivar fqdn: Fully qualified dns Name. + :vartype fqdn: str + :ivar https_only: Indicate if only https is allowed. + :vartype https_only: bool + :ivar created_time: Date time when the resource is created. + :vartype created_time: ~datetime.datetime + :ivar temporary_disk: Temporary disk settings. + :vartype temporary_disk: ~azure.mgmt.appplatform.v2021_09_01_preview.models.TemporaryDisk + :ivar persistent_disk: Persistent disk settings. + :vartype persistent_disk: ~azure.mgmt.appplatform.v2021_09_01_preview.models.PersistentDisk + :ivar custom_persistent_disks: List of custom persistent disks. + :vartype custom_persistent_disks: + list[~azure.mgmt.appplatform.v2021_09_01_preview.models.CustomPersistentDiskResource] + :ivar enable_end_to_end_tls: Indicate if end to end TLS is enabled. + :vartype enable_end_to_end_tls: bool + :ivar loaded_certificates: Collection of loaded certificates. + :vartype loaded_certificates: + list[~azure.mgmt.appplatform.v2021_09_01_preview.models.LoadedCertificate] + """ + + _validation = { + 'url': {'readonly': True}, + 'provisioning_state': {'readonly': True}, + 'created_time': {'readonly': True}, + } + + _attribute_map = { + 'public': {'key': 'public', 'type': 'bool'}, + 'url': {'key': 'url', 'type': 'str'}, + 'provisioning_state': {'key': 'provisioningState', 'type': 'str'}, + 'active_deployment_name': {'key': 'activeDeploymentName', 'type': 'str'}, + 'fqdn': {'key': 'fqdn', 'type': 'str'}, + 'https_only': {'key': 'httpsOnly', 'type': 'bool'}, + 'created_time': {'key': 'createdTime', 'type': 'iso-8601'}, + 'temporary_disk': {'key': 'temporaryDisk', 'type': 'TemporaryDisk'}, + 'persistent_disk': {'key': 'persistentDisk', 'type': 'PersistentDisk'}, + 'custom_persistent_disks': {'key': 'customPersistentDisks', 'type': '[CustomPersistentDiskResource]'}, + 'enable_end_to_end_tls': {'key': 'enableEndToEndTLS', 'type': 'bool'}, + 'loaded_certificates': {'key': 'loadedCertificates', 'type': '[LoadedCertificate]'}, + } + + 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, + custom_persistent_disks: Optional[List["CustomPersistentDiskResource"]] = None, + enable_end_to_end_tls: Optional[bool] = False, + loaded_certificates: Optional[List["LoadedCertificate"]] = None, + **kwargs + ): + """ + :keyword public: Indicates whether the App exposes public endpoint. + :paramtype public: bool + :keyword active_deployment_name: Name of the active deployment of the App. + :paramtype active_deployment_name: str + :keyword fqdn: Fully qualified dns Name. + :paramtype fqdn: str + :keyword https_only: Indicate if only https is allowed. + :paramtype https_only: bool + :keyword temporary_disk: Temporary disk settings. + :paramtype temporary_disk: ~azure.mgmt.appplatform.v2021_09_01_preview.models.TemporaryDisk + :keyword persistent_disk: Persistent disk settings. + :paramtype persistent_disk: ~azure.mgmt.appplatform.v2021_09_01_preview.models.PersistentDisk + :keyword custom_persistent_disks: List of custom persistent disks. + :paramtype custom_persistent_disks: + list[~azure.mgmt.appplatform.v2021_09_01_preview.models.CustomPersistentDiskResource] + :keyword enable_end_to_end_tls: Indicate if end to end TLS is enabled. + :paramtype enable_end_to_end_tls: bool + :keyword loaded_certificates: Collection of loaded certificates. + :paramtype loaded_certificates: + list[~azure.mgmt.appplatform.v2021_09_01_preview.models.LoadedCertificate] + """ + super(AppResourceProperties, self).__init__(**kwargs) + self.public = public + self.url = None + self.provisioning_state = None + self.active_deployment_name = active_deployment_name + self.fqdn = fqdn + self.https_only = https_only + self.created_time = None + self.temporary_disk = temporary_disk + self.persistent_disk = persistent_disk + self.custom_persistent_disks = custom_persistent_disks + self.enable_end_to_end_tls = enable_end_to_end_tls + self.loaded_certificates = loaded_certificates + + +class AvailableOperations(msrest.serialization.Model): + """Available operations of the service. + + :ivar value: Collection of available operation details. + :vartype value: list[~azure.mgmt.appplatform.v2021_09_01_preview.models.OperationDetail] + :ivar next_link: URL client should use to fetch the next page (per server side paging). + It's null for now, added for future use. + :vartype 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 + ): + """ + :keyword value: Collection of available operation details. + :paramtype value: list[~azure.mgmt.appplatform.v2021_09_01_preview.models.OperationDetail] + :keyword next_link: URL client should use to fetch the next page (per server side paging). + It's null for now, added for future use. + :paramtype next_link: str + """ + 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. + + :ivar value: A list of all supported runtime versions. + :vartype value: + list[~azure.mgmt.appplatform.v2021_09_01_preview.models.SupportedRuntimeVersion] + """ + + _validation = { + 'value': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[SupportedRuntimeVersion]'}, + } + + def __init__( + self, + **kwargs + ): + """ + """ + super(AvailableRuntimeVersions, self).__init__(**kwargs) + self.value = None + + +class CustomPersistentDiskProperties(msrest.serialization.Model): + """Custom persistent disk resource payload. + + You probably want to use the sub-classes and not this class directly. Known + sub-classes are: AzureFileVolume. + + All required parameters must be populated in order to send to Azure. + + :ivar type: Required. The type of the underlying resource to mount as a persistent + disk.Constant filled by server. + :vartype type: str + :ivar mount_path: Required. The mount path of the persistent disk. + :vartype mount_path: str + :ivar read_only: Indicates whether the persistent disk is a readOnly one. + :vartype read_only: bool + :ivar mount_options: These are the mount options for a persistent disk. + :vartype mount_options: list[str] + """ + + _validation = { + 'type': {'required': True}, + 'mount_path': {'required': True}, + } + + _attribute_map = { + 'type': {'key': 'type', 'type': 'str'}, + 'mount_path': {'key': 'mountPath', 'type': 'str'}, + 'read_only': {'key': 'readOnly', 'type': 'bool'}, + 'mount_options': {'key': 'mountOptions', 'type': '[str]'}, + } + + _subtype_map = { + 'type': {'AzureFileVolume': 'AzureFileVolume'} + } + + def __init__( + self, + *, + mount_path: str, + read_only: Optional[bool] = None, + mount_options: Optional[List[str]] = None, + **kwargs + ): + """ + :keyword mount_path: Required. The mount path of the persistent disk. + :paramtype mount_path: str + :keyword read_only: Indicates whether the persistent disk is a readOnly one. + :paramtype read_only: bool + :keyword mount_options: These are the mount options for a persistent disk. + :paramtype mount_options: list[str] + """ + super(CustomPersistentDiskProperties, self).__init__(**kwargs) + self.type = None # type: Optional[str] + self.mount_path = mount_path + self.read_only = read_only + self.mount_options = mount_options + + +class AzureFileVolume(CustomPersistentDiskProperties): + """The properties of the Azure File volume. Azure File shares are mounted as volumes. + + All required parameters must be populated in order to send to Azure. + + :ivar type: Required. The type of the underlying resource to mount as a persistent + disk.Constant filled by server. + :vartype type: str + :ivar mount_path: Required. The mount path of the persistent disk. + :vartype mount_path: str + :ivar read_only: Indicates whether the persistent disk is a readOnly one. + :vartype read_only: bool + :ivar mount_options: These are the mount options for a persistent disk. + :vartype mount_options: list[str] + :ivar share_name: Required. The share name of the Azure File share. + :vartype share_name: str + """ + + _validation = { + 'type': {'required': True}, + 'mount_path': {'required': True}, + 'share_name': {'required': True}, + } + + _attribute_map = { + 'type': {'key': 'type', 'type': 'str'}, + 'mount_path': {'key': 'mountPath', 'type': 'str'}, + 'read_only': {'key': 'readOnly', 'type': 'bool'}, + 'mount_options': {'key': 'mountOptions', 'type': '[str]'}, + 'share_name': {'key': 'shareName', 'type': 'str'}, + } + + def __init__( + self, + *, + mount_path: str, + share_name: str, + read_only: Optional[bool] = None, + mount_options: Optional[List[str]] = None, + **kwargs + ): + """ + :keyword mount_path: Required. The mount path of the persistent disk. + :paramtype mount_path: str + :keyword read_only: Indicates whether the persistent disk is a readOnly one. + :paramtype read_only: bool + :keyword mount_options: These are the mount options for a persistent disk. + :paramtype mount_options: list[str] + :keyword share_name: Required. The share name of the Azure File share. + :paramtype share_name: str + """ + super(AzureFileVolume, self).__init__(mount_path=mount_path, read_only=read_only, mount_options=mount_options, **kwargs) + self.type = 'AzureFileVolume' # type: str + self.share_name = share_name + + +class BindingResource(ProxyResource): + """Binding resource payload. + + 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 + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. + :vartype type: str + :ivar properties: Properties of the Binding resource. + :vartype properties: + ~azure.mgmt.appplatform.v2021_09_01_preview.models.BindingResourceProperties + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'properties': {'key': 'properties', 'type': 'BindingResourceProperties'}, + } + + def __init__( + self, + *, + properties: Optional["BindingResourceProperties"] = None, + **kwargs + ): + """ + :keyword properties: Properties of the Binding resource. + :paramtype properties: + ~azure.mgmt.appplatform.v2021_09_01_preview.models.BindingResourceProperties + """ + super(BindingResource, self).__init__(**kwargs) + self.properties = properties + + +class BindingResourceCollection(msrest.serialization.Model): + """Object that includes an array of Binding resources and a possible link for next set. + + :ivar value: Collection of Binding resources. + :vartype value: list[~azure.mgmt.appplatform.v2021_09_01_preview.models.BindingResource] + :ivar next_link: URL client should use to fetch the next page (per server side paging). + It's null for now, added for future use. + :vartype 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 + ): + """ + :keyword value: Collection of Binding resources. + :paramtype value: list[~azure.mgmt.appplatform.v2021_09_01_preview.models.BindingResource] + :keyword next_link: URL client should use to fetch the next page (per server side paging). + It's null for now, added for future use. + :paramtype next_link: str + """ + 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. + + :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. + :vartype resource_type: str + :ivar resource_id: The Azure resource id of the bound resource. + :vartype resource_id: str + :ivar key: The key of the bound resource. + :vartype key: str + :ivar binding_parameters: Binding parameters of the Binding resource. + :vartype 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. + :vartype created_at: str + :ivar updated_at: Update time of the Binding resource. + :vartype updated_at: str + """ + + _validation = { + 'resource_name': {'readonly': True}, + 'resource_type': {'readonly': True}, + 'generated_properties': {'readonly': True}, + 'created_at': {'readonly': True}, + 'updated_at': {'readonly': True}, + } + + _attribute_map = { + 'resource_name': {'key': 'resourceName', 'type': 'str'}, + 'resource_type': {'key': 'resourceType', 'type': 'str'}, + 'resource_id': {'key': 'resourceId', 'type': 'str'}, + 'key': {'key': 'key', 'type': 'str'}, + 'binding_parameters': {'key': 'bindingParameters', 'type': '{object}'}, + 'generated_properties': {'key': 'generatedProperties', 'type': 'str'}, + 'created_at': {'key': 'createdAt', 'type': 'str'}, + 'updated_at': {'key': 'updatedAt', 'type': 'str'}, + } + + def __init__( + self, + *, + resource_id: Optional[str] = None, + key: Optional[str] = None, + binding_parameters: Optional[Dict[str, Any]] = None, + **kwargs + ): + """ + :keyword resource_id: The Azure resource id of the bound resource. + :paramtype resource_id: str + :keyword key: The key of the bound resource. + :paramtype key: str + :keyword binding_parameters: Binding parameters of the Binding resource. + :paramtype binding_parameters: dict[str, any] + """ + super(BindingResourceProperties, self).__init__(**kwargs) + self.resource_name = None + self.resource_type = None + self.resource_id = resource_id + self.key = key + self.binding_parameters = binding_parameters + self.generated_properties = None + self.created_at = None + self.updated_at = None + + +class CertificateProperties(msrest.serialization.Model): + """Certificate resource payload. + + You probably want to use the sub-classes and not this class directly. Known + sub-classes are: ContentCertificateProperties, KeyVaultCertificateProperties. + + 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. + + :ivar type: Required. The type of the certificate source.Constant filled by server. + :vartype type: str + :ivar thumbprint: The thumbprint of certificate. + :vartype thumbprint: str + :ivar issuer: The issuer of certificate. + :vartype issuer: str + :ivar issued_date: The issue date of certificate. + :vartype issued_date: str + :ivar expiration_date: The expiration date of certificate. + :vartype expiration_date: str + :ivar activate_date: The activate date of certificate. + :vartype activate_date: str + :ivar subject_name: The subject name of certificate. + :vartype subject_name: str + :ivar dns_names: The domain list of certificate. + :vartype dns_names: list[str] + """ + + _validation = { + 'type': {'required': True}, + 'thumbprint': {'readonly': True}, + 'issuer': {'readonly': True}, + 'issued_date': {'readonly': True}, + 'expiration_date': {'readonly': True}, + 'activate_date': {'readonly': True}, + 'subject_name': {'readonly': True}, + 'dns_names': {'readonly': True}, + } + + _attribute_map = { + 'type': {'key': 'type', 'type': 'str'}, + 'thumbprint': {'key': 'thumbprint', 'type': 'str'}, + 'issuer': {'key': 'issuer', 'type': 'str'}, + 'issued_date': {'key': 'issuedDate', 'type': 'str'}, + 'expiration_date': {'key': 'expirationDate', 'type': 'str'}, + 'activate_date': {'key': 'activateDate', 'type': 'str'}, + 'subject_name': {'key': 'subjectName', 'type': 'str'}, + 'dns_names': {'key': 'dnsNames', 'type': '[str]'}, + } + + _subtype_map = { + 'type': {'ContentCertificate': 'ContentCertificateProperties', 'KeyVaultCertificate': 'KeyVaultCertificateProperties'} + } + + def __init__( + self, + **kwargs + ): + """ + """ + super(CertificateProperties, self).__init__(**kwargs) + self.type = None # type: Optional[str] + self.thumbprint = None + self.issuer = None + self.issued_date = None + self.expiration_date = None + self.activate_date = None + self.subject_name = None + self.dns_names = None + + +class CertificateResource(ProxyResource): + """Certificate resource payload. + + 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 + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. + :vartype type: str + :ivar properties: Properties of the certificate resource payload. + :vartype properties: ~azure.mgmt.appplatform.v2021_09_01_preview.models.CertificateProperties + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'properties': {'key': 'properties', 'type': 'CertificateProperties'}, + } + + def __init__( + self, + *, + properties: Optional["CertificateProperties"] = None, + **kwargs + ): + """ + :keyword properties: Properties of the certificate resource payload. + :paramtype properties: ~azure.mgmt.appplatform.v2021_09_01_preview.models.CertificateProperties + """ + super(CertificateResource, self).__init__(**kwargs) + self.properties = properties + + +class CertificateResourceCollection(msrest.serialization.Model): + """Collection compose of certificate resources list and a possible link for next page. + + :ivar value: The certificate resources list. + :vartype value: list[~azure.mgmt.appplatform.v2021_09_01_preview.models.CertificateResource] + :ivar next_link: The link to next page of certificate list. + :vartype next_link: str + """ + + _attribute_map = { + '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 + ): + """ + :keyword value: The certificate resources list. + :paramtype value: list[~azure.mgmt.appplatform.v2021_09_01_preview.models.CertificateResource] + :keyword next_link: The link to next page of certificate list. + :paramtype next_link: str + """ + super(CertificateResourceCollection, self).__init__(**kwargs) + self.value = value + self.next_link = next_link + + +class CloudErrorBody(msrest.serialization.Model): + """An error response from the service. + + :ivar code: An identifier for the error. Codes are invariant and are intended to be consumed + programmatically. + :vartype code: str + :ivar message: A message describing the error, intended to be suitable for display in a user + interface. + :vartype message: str + :ivar target: The target of the particular error. For example, the name of the property in + error. + :vartype target: str + :ivar details: A list of additional details about the error. + :vartype details: list[~azure.mgmt.appplatform.v2021_09_01_preview.models.CloudErrorBody] + """ + + _attribute_map = { + 'code': {'key': 'code', 'type': 'str'}, + 'message': {'key': 'message', 'type': 'str'}, + 'target': {'key': 'target', 'type': 'str'}, + 'details': {'key': 'details', 'type': '[CloudErrorBody]'}, + } + + def __init__( + self, + *, + code: Optional[str] = None, + message: Optional[str] = None, + target: Optional[str] = None, + details: Optional[List["CloudErrorBody"]] = None, + **kwargs + ): + """ + :keyword code: An identifier for the error. Codes are invariant and are intended to be consumed + programmatically. + :paramtype code: str + :keyword message: A message describing the error, intended to be suitable for display in a user + interface. + :paramtype message: str + :keyword target: The target of the particular error. For example, the name of the property in + error. + :paramtype target: str + :keyword details: A list of additional details about the error. + :paramtype details: list[~azure.mgmt.appplatform.v2021_09_01_preview.models.CloudErrorBody] + """ + super(CloudErrorBody, self).__init__(**kwargs) + self.code = code + self.message = message + self.target = target + self.details = details + + +class ClusterResourceProperties(msrest.serialization.Model): + """Service properties payload. + + 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". + :vartype provisioning_state: str or + ~azure.mgmt.appplatform.v2021_09_01_preview.models.ProvisioningState + :ivar network_profile: Network profile of the Service. + :vartype network_profile: ~azure.mgmt.appplatform.v2021_09_01_preview.models.NetworkProfile + :ivar version: Version of the Service. + :vartype version: int + :ivar service_id: ServiceInstanceEntity GUID which uniquely identifies a created resource. + :vartype service_id: str + :ivar power_state: Power state of the Service. Possible values include: "Running", "Stopped". + :vartype power_state: str or ~azure.mgmt.appplatform.v2021_09_01_preview.models.PowerState + """ + + _validation = { + 'provisioning_state': {'readonly': True}, + 'version': {'readonly': True}, + 'service_id': {'readonly': True}, + 'power_state': {'readonly': True}, + } + + _attribute_map = { + 'provisioning_state': {'key': 'provisioningState', 'type': 'str'}, + 'network_profile': {'key': 'networkProfile', 'type': 'NetworkProfile'}, + 'version': {'key': 'version', 'type': 'int'}, + 'service_id': {'key': 'serviceId', 'type': 'str'}, + 'power_state': {'key': 'powerState', 'type': 'str'}, + } + + def __init__( + self, + *, + network_profile: Optional["NetworkProfile"] = None, + **kwargs + ): + """ + :keyword network_profile: Network profile of the Service. + :paramtype network_profile: ~azure.mgmt.appplatform.v2021_09_01_preview.models.NetworkProfile + """ + super(ClusterResourceProperties, self).__init__(**kwargs) + self.provisioning_state = None + self.network_profile = network_profile + self.version = None + self.service_id = None + self.power_state = None + + +class ConfigServerGitProperty(msrest.serialization.Model): + """Property of git. + + All required parameters must be populated in order to send to Azure. + + :ivar repositories: Repositories of git. + :vartype repositories: + list[~azure.mgmt.appplatform.v2021_09_01_preview.models.GitPatternRepository] + :ivar uri: Required. URI of the repository. + :vartype uri: str + :ivar label: Label of the repository. + :vartype label: str + :ivar search_paths: Searching path of the repository. + :vartype search_paths: list[str] + :ivar username: Username of git repository basic auth. + :vartype username: str + :ivar password: Password of git repository basic auth. + :vartype password: str + :ivar host_key: Public sshKey of git repository. + :vartype host_key: str + :ivar host_key_algorithm: SshKey algorithm of git repository. + :vartype host_key_algorithm: str + :ivar private_key: Private sshKey algorithm of git repository. + :vartype private_key: str + :ivar strict_host_key_checking: Strict host key checking or not. + :vartype strict_host_key_checking: bool + """ + + _validation = { + 'uri': {'required': True}, + } + + _attribute_map = { + 'repositories': {'key': 'repositories', 'type': '[GitPatternRepository]'}, + 'uri': {'key': 'uri', 'type': 'str'}, + 'label': {'key': 'label', 'type': 'str'}, + 'search_paths': {'key': 'searchPaths', 'type': '[str]'}, + 'username': {'key': 'username', 'type': 'str'}, + 'password': {'key': 'password', 'type': 'str'}, + 'host_key': {'key': 'hostKey', 'type': 'str'}, + 'host_key_algorithm': {'key': 'hostKeyAlgorithm', 'type': 'str'}, + 'private_key': {'key': 'privateKey', 'type': 'str'}, + 'strict_host_key_checking': {'key': 'strictHostKeyChecking', 'type': 'bool'}, + } + + 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 + ): + """ + :keyword repositories: Repositories of git. + :paramtype repositories: + list[~azure.mgmt.appplatform.v2021_09_01_preview.models.GitPatternRepository] + :keyword uri: Required. URI of the repository. + :paramtype uri: str + :keyword label: Label of the repository. + :paramtype label: str + :keyword search_paths: Searching path of the repository. + :paramtype search_paths: list[str] + :keyword username: Username of git repository basic auth. + :paramtype username: str + :keyword password: Password of git repository basic auth. + :paramtype password: str + :keyword host_key: Public sshKey of git repository. + :paramtype host_key: str + :keyword host_key_algorithm: SshKey algorithm of git repository. + :paramtype host_key_algorithm: str + :keyword private_key: Private sshKey algorithm of git repository. + :paramtype private_key: str + :keyword strict_host_key_checking: Strict host key checking or not. + :paramtype strict_host_key_checking: bool + """ + super(ConfigServerGitProperty, self).__init__(**kwargs) + self.repositories = repositories + self.uri = uri + self.label = label + self.search_paths = search_paths + self.username = username + self.password = password + self.host_key = host_key + self.host_key_algorithm = host_key_algorithm + self.private_key = private_key + self.strict_host_key_checking = strict_host_key_checking + + +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. + + :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_09_01_preview.models.ConfigServerState + :ivar error: Error when apply config server settings. + :vartype error: ~azure.mgmt.appplatform.v2021_09_01_preview.models.Error + :ivar config_server: Settings of config server. + :vartype config_server: ~azure.mgmt.appplatform.v2021_09_01_preview.models.ConfigServerSettings + """ + + _validation = { + 'provisioning_state': {'readonly': True}, + } + + _attribute_map = { + 'provisioning_state': {'key': 'provisioningState', 'type': 'str'}, + 'error': {'key': 'error', 'type': 'Error'}, + 'config_server': {'key': 'configServer', 'type': 'ConfigServerSettings'}, + } + + def __init__( + self, + *, + error: Optional["Error"] = None, + config_server: Optional["ConfigServerSettings"] = None, + **kwargs + ): + """ + :keyword error: Error when apply config server settings. + :paramtype error: ~azure.mgmt.appplatform.v2021_09_01_preview.models.Error + :keyword config_server: Settings of config server. + :paramtype config_server: + ~azure.mgmt.appplatform.v2021_09_01_preview.models.ConfigServerSettings + """ + super(ConfigServerProperties, self).__init__(**kwargs) + self.provisioning_state = None + self.error = error + self.config_server = config_server + + +class ConfigServerResource(ProxyResource): + """Config Server resource. + + 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 + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. + :vartype type: str + :ivar properties: Properties of the Config Server resource. + :vartype properties: ~azure.mgmt.appplatform.v2021_09_01_preview.models.ConfigServerProperties + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'properties': {'key': 'properties', 'type': 'ConfigServerProperties'}, + } + + def __init__( + self, + *, + properties: Optional["ConfigServerProperties"] = None, + **kwargs + ): + """ + :keyword properties: Properties of the Config Server resource. + :paramtype properties: + ~azure.mgmt.appplatform.v2021_09_01_preview.models.ConfigServerProperties + """ + super(ConfigServerResource, self).__init__(**kwargs) + self.properties = properties + + +class ConfigServerSettings(msrest.serialization.Model): + """The settings of config server. + + :ivar git_property: Property of git environment. + :vartype git_property: + ~azure.mgmt.appplatform.v2021_09_01_preview.models.ConfigServerGitProperty + """ + + _attribute_map = { + 'git_property': {'key': 'gitProperty', 'type': 'ConfigServerGitProperty'}, + } + + def __init__( + self, + *, + git_property: Optional["ConfigServerGitProperty"] = None, + **kwargs + ): + """ + :keyword git_property: Property of git environment. + :paramtype git_property: + ~azure.mgmt.appplatform.v2021_09_01_preview.models.ConfigServerGitProperty + """ + super(ConfigServerSettings, self).__init__(**kwargs) + self.git_property = git_property + + +class ConfigServerSettingsErrorRecord(msrest.serialization.Model): + """Error record of the config server settings. + + :ivar name: The name of the config server settings error record. + :vartype name: str + :ivar uri: The uri of the config server settings error record. + :vartype uri: str + :ivar messages: The detail error messages of the record. + :vartype messages: list[str] + """ + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'uri': {'key': 'uri', 'type': 'str'}, + 'messages': {'key': 'messages', 'type': '[str]'}, + } + + def __init__( + self, + *, + name: Optional[str] = None, + uri: Optional[str] = None, + messages: Optional[List[str]] = None, + **kwargs + ): + """ + :keyword name: The name of the config server settings error record. + :paramtype name: str + :keyword uri: The uri of the config server settings error record. + :paramtype uri: str + :keyword messages: The detail error messages of the record. + :paramtype messages: list[str] + """ + super(ConfigServerSettingsErrorRecord, self).__init__(**kwargs) + self.name = name + self.uri = uri + self.messages = messages + + +class ConfigServerSettingsValidateResult(msrest.serialization.Model): + """Validation result for config server settings. + + :ivar is_valid: Indicate if the config server settings are valid. + :vartype is_valid: bool + :ivar details: The detail validation results. + :vartype details: + list[~azure.mgmt.appplatform.v2021_09_01_preview.models.ConfigServerSettingsErrorRecord] + """ + + _attribute_map = { + 'is_valid': {'key': 'isValid', 'type': 'bool'}, + 'details': {'key': 'details', 'type': '[ConfigServerSettingsErrorRecord]'}, + } + + def __init__( + self, + *, + is_valid: Optional[bool] = None, + details: Optional[List["ConfigServerSettingsErrorRecord"]] = None, + **kwargs + ): + """ + :keyword is_valid: Indicate if the config server settings are valid. + :paramtype is_valid: bool + :keyword details: The detail validation results. + :paramtype details: + list[~azure.mgmt.appplatform.v2021_09_01_preview.models.ConfigServerSettingsErrorRecord] + """ + super(ConfigServerSettingsValidateResult, self).__init__(**kwargs) + self.is_valid = is_valid + self.details = details + + +class ContentCertificateProperties(CertificateProperties): + """Properties of certificate imported from key vault. + + 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. + + :ivar type: Required. The type of the certificate source.Constant filled by server. + :vartype type: str + :ivar thumbprint: The thumbprint of certificate. + :vartype thumbprint: str + :ivar issuer: The issuer of certificate. + :vartype issuer: str + :ivar issued_date: The issue date of certificate. + :vartype issued_date: str + :ivar expiration_date: The expiration date of certificate. + :vartype expiration_date: str + :ivar activate_date: The activate date of certificate. + :vartype activate_date: str + :ivar subject_name: The subject name of certificate. + :vartype subject_name: str + :ivar dns_names: The domain list of certificate. + :vartype dns_names: list[str] + :ivar content: Required. The content of uploaded certificate. + :vartype content: str + """ + + _validation = { + 'type': {'required': True}, + 'thumbprint': {'readonly': True}, + 'issuer': {'readonly': True}, + 'issued_date': {'readonly': True}, + 'expiration_date': {'readonly': True}, + 'activate_date': {'readonly': True}, + 'subject_name': {'readonly': True}, + 'dns_names': {'readonly': True}, + 'content': {'required': True}, + } + + _attribute_map = { + 'type': {'key': 'type', 'type': 'str'}, + 'thumbprint': {'key': 'thumbprint', 'type': 'str'}, + 'issuer': {'key': 'issuer', 'type': 'str'}, + 'issued_date': {'key': 'issuedDate', 'type': 'str'}, + 'expiration_date': {'key': 'expirationDate', 'type': 'str'}, + 'activate_date': {'key': 'activateDate', 'type': 'str'}, + 'subject_name': {'key': 'subjectName', 'type': 'str'}, + 'dns_names': {'key': 'dnsNames', 'type': '[str]'}, + 'content': {'key': 'content', 'type': 'str'}, + } + + def __init__( + self, + *, + content: str, + **kwargs + ): + """ + :keyword content: Required. The content of uploaded certificate. + :paramtype content: str + """ + super(ContentCertificateProperties, self).__init__(**kwargs) + self.type = 'ContentCertificate' # type: str + self.content = content + + +class CustomContainer(msrest.serialization.Model): + """Custom container payload. + + :ivar server: The name of the registry that contains the container image. + :vartype server: str + :ivar container_image: Container image of the custom container. This should be in the form of + :code:``::code:`` without the server name of the registry. + :vartype container_image: str + :ivar command: Entrypoint array. Not executed within a shell. The docker image's ENTRYPOINT is + used if this is not provided. + :vartype command: list[str] + :ivar args: Arguments to the entrypoint. The docker image's CMD is used if this is not + provided. + :vartype args: list[str] + :ivar image_registry_credential: Credential of the image registry. + :vartype image_registry_credential: + ~azure.mgmt.appplatform.v2021_09_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 + ): + """ + :keyword server: The name of the registry that contains the container image. + :paramtype server: str + :keyword container_image: Container image of the custom container. This should be in the form + of :code:``::code:`` without the server name of the registry. + :paramtype container_image: str + :keyword command: Entrypoint array. Not executed within a shell. The docker image's ENTRYPOINT + is used if this is not provided. + :paramtype command: list[str] + :keyword args: Arguments to the entrypoint. The docker image's CMD is used if this is not + provided. + :paramtype args: list[str] + :keyword image_registry_credential: Credential of the image registry. + :paramtype image_registry_credential: + ~azure.mgmt.appplatform.v2021_09_01_preview.models.ImageRegistryCredential + """ + 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. + + :ivar thumbprint: The thumbprint of bound certificate. + :vartype thumbprint: str + :ivar app_name: The app name of domain. + :vartype app_name: str + :ivar cert_name: The bound certificate name of domain. + :vartype cert_name: str + """ + + _validation = { + 'app_name': {'readonly': True}, + } + + _attribute_map = { + 'thumbprint': {'key': 'thumbprint', 'type': 'str'}, + 'app_name': {'key': 'appName', 'type': 'str'}, + 'cert_name': {'key': 'certName', 'type': 'str'}, + } + + def __init__( + self, + *, + thumbprint: Optional[str] = None, + cert_name: Optional[str] = None, + **kwargs + ): + """ + :keyword thumbprint: The thumbprint of bound certificate. + :paramtype thumbprint: str + :keyword cert_name: The bound certificate name of domain. + :paramtype cert_name: str + """ + super(CustomDomainProperties, self).__init__(**kwargs) + self.thumbprint = thumbprint + self.app_name = None + self.cert_name = cert_name + + +class CustomDomainResource(ProxyResource): + """Custom domain resource payload. + + 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 + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. + :vartype type: str + :ivar properties: Properties of the custom domain resource. + :vartype properties: ~azure.mgmt.appplatform.v2021_09_01_preview.models.CustomDomainProperties + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'properties': {'key': 'properties', 'type': 'CustomDomainProperties'}, + } + + def __init__( + self, + *, + properties: Optional["CustomDomainProperties"] = None, + **kwargs + ): + """ + :keyword properties: Properties of the custom domain resource. + :paramtype properties: + ~azure.mgmt.appplatform.v2021_09_01_preview.models.CustomDomainProperties + """ + super(CustomDomainResource, self).__init__(**kwargs) + self.properties = properties + + +class CustomDomainResourceCollection(msrest.serialization.Model): + """Collection compose of a custom domain resources list and a possible link for next page. + + :ivar value: The custom domain resources list. + :vartype value: list[~azure.mgmt.appplatform.v2021_09_01_preview.models.CustomDomainResource] + :ivar next_link: The link to next page of custom domain list. + :vartype 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 + ): + """ + :keyword value: The custom domain resources list. + :paramtype value: list[~azure.mgmt.appplatform.v2021_09_01_preview.models.CustomDomainResource] + :keyword next_link: The link to next page of custom domain list. + :paramtype next_link: str + """ + 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. + + :ivar name: Required. Name to be validated. + :vartype name: str + """ + + _validation = { + 'name': {'required': True}, + } + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + } + + def __init__( + self, + *, + name: str, + **kwargs + ): + """ + :keyword name: Required. Name to be validated. + :paramtype name: str + """ + super(CustomDomainValidatePayload, self).__init__(**kwargs) + self.name = name + + +class CustomDomainValidateResult(msrest.serialization.Model): + """Validation result for custom domain. + + :ivar is_valid: Indicates if domain name is valid. + :vartype is_valid: bool + :ivar message: Message of why domain name is invalid. + :vartype message: str + """ + + _attribute_map = { + 'is_valid': {'key': 'isValid', 'type': 'bool'}, + 'message': {'key': 'message', 'type': 'str'}, + } + + def __init__( + self, + *, + is_valid: Optional[bool] = None, + message: Optional[str] = None, + **kwargs + ): + """ + :keyword is_valid: Indicates if domain name is valid. + :paramtype is_valid: bool + :keyword message: Message of why domain name is invalid. + :paramtype message: str + """ + super(CustomDomainValidateResult, self).__init__(**kwargs) + self.is_valid = is_valid + self.message = message + + +class CustomPersistentDiskResource(msrest.serialization.Model): + """Custom persistent disk resource payload. + + All required parameters must be populated in order to send to Azure. + + :ivar custom_persistent_disk_properties: Properties of the custom persistent disk resource + payload. + :vartype custom_persistent_disk_properties: + ~azure.mgmt.appplatform.v2021_09_01_preview.models.CustomPersistentDiskProperties + :ivar storage_id: Required. The resource id of Azure Spring Cloud Storage resource. + :vartype storage_id: str + """ + + _validation = { + 'storage_id': {'required': True}, + } + + _attribute_map = { + 'custom_persistent_disk_properties': {'key': 'customPersistentDiskProperties', 'type': 'CustomPersistentDiskProperties'}, + 'storage_id': {'key': 'storageId', 'type': 'str'}, + } + + def __init__( + self, + *, + storage_id: str, + custom_persistent_disk_properties: Optional["CustomPersistentDiskProperties"] = None, + **kwargs + ): + """ + :keyword custom_persistent_disk_properties: Properties of the custom persistent disk resource + payload. + :paramtype custom_persistent_disk_properties: + ~azure.mgmt.appplatform.v2021_09_01_preview.models.CustomPersistentDiskProperties + :keyword storage_id: Required. The resource id of Azure Spring Cloud Storage resource. + :paramtype storage_id: str + """ + super(CustomPersistentDiskResource, self).__init__(**kwargs) + self.custom_persistent_disk_properties = custom_persistent_disk_properties + self.storage_id = storage_id + + +class DeploymentInstance(msrest.serialization.Model): + """Deployment instance payload. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar name: Name of the deployment instance. + :vartype name: str + :ivar status: Status of the deployment instance. + :vartype status: str + :ivar reason: Failed reason of the deployment instance. + :vartype reason: str + :ivar discovery_status: Discovery status of the deployment instance. + :vartype discovery_status: str + :ivar start_time: Start time of the deployment instance. + :vartype start_time: str + """ + + _validation = { + 'name': {'readonly': True}, + 'status': {'readonly': True}, + 'reason': {'readonly': True}, + 'discovery_status': {'readonly': True}, + 'start_time': {'readonly': True}, + } + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'status': {'key': 'status', 'type': 'str'}, + 'reason': {'key': 'reason', 'type': 'str'}, + 'discovery_status': {'key': 'discoveryStatus', 'type': 'str'}, + 'start_time': {'key': 'startTime', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + """ + """ + super(DeploymentInstance, self).__init__(**kwargs) + self.name = None + self.status = None + self.reason = None + self.discovery_status = None + self.start_time = None + + +class DeploymentResource(ProxyResource): + """Deployment resource payload. + + 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 + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. + :vartype type: str + :ivar properties: Properties of the Deployment resource. + :vartype properties: + ~azure.mgmt.appplatform.v2021_09_01_preview.models.DeploymentResourceProperties + :ivar sku: Sku of the Deployment resource. + :vartype sku: ~azure.mgmt.appplatform.v2021_09_01_preview.models.Sku + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'properties': {'key': 'properties', 'type': 'DeploymentResourceProperties'}, + 'sku': {'key': 'sku', 'type': 'Sku'}, + } + + def __init__( + self, + *, + properties: Optional["DeploymentResourceProperties"] = None, + sku: Optional["Sku"] = None, + **kwargs + ): + """ + :keyword properties: Properties of the Deployment resource. + :paramtype properties: + ~azure.mgmt.appplatform.v2021_09_01_preview.models.DeploymentResourceProperties + :keyword sku: Sku of the Deployment resource. + :paramtype sku: ~azure.mgmt.appplatform.v2021_09_01_preview.models.Sku + """ + super(DeploymentResource, self).__init__(**kwargs) + self.properties = properties + self.sku = sku + + +class DeploymentResourceCollection(msrest.serialization.Model): + """Object that includes an array of App resources and a possible link for next set. + + :ivar value: Collection of Deployment resources. + :vartype value: list[~azure.mgmt.appplatform.v2021_09_01_preview.models.DeploymentResource] + :ivar next_link: URL client should use to fetch the next page (per server side paging). + It's null for now, added for future use. + :vartype 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 + ): + """ + :keyword value: Collection of Deployment resources. + :paramtype value: list[~azure.mgmt.appplatform.v2021_09_01_preview.models.DeploymentResource] + :keyword next_link: URL client should use to fetch the next page (per server side paging). + It's null for now, added for future use. + :paramtype next_link: str + """ + 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. + + :ivar source: Uploaded source information of the deployment. + :vartype source: ~azure.mgmt.appplatform.v2021_09_01_preview.models.UserSourceInfo + :ivar app_name: App name of the deployment. + :vartype app_name: str + :ivar deployment_settings: Deployment settings of the Deployment. + :vartype deployment_settings: + ~azure.mgmt.appplatform.v2021_09_01_preview.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.v2021_09_01_preview.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.v2021_09_01_preview.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.datetime + :ivar instances: Collection of instances belong to the Deployment. + :vartype instances: list[~azure.mgmt.appplatform.v2021_09_01_preview.models.DeploymentInstance] + """ + + _validation = { + 'app_name': {'readonly': True}, + 'provisioning_state': {'readonly': True}, + 'status': {'readonly': True}, + 'active': {'readonly': True}, + 'created_time': {'readonly': True}, + 'instances': {'readonly': True}, + } + + _attribute_map = { + 'source': {'key': 'source', 'type': 'UserSourceInfo'}, + 'app_name': {'key': 'appName', 'type': 'str'}, + 'deployment_settings': {'key': 'deploymentSettings', 'type': 'DeploymentSettings'}, + 'provisioning_state': {'key': 'provisioningState', 'type': 'str'}, + 'status': {'key': 'status', 'type': 'str'}, + 'active': {'key': 'active', 'type': 'bool'}, + 'created_time': {'key': 'createdTime', 'type': 'iso-8601'}, + 'instances': {'key': 'instances', 'type': '[DeploymentInstance]'}, + } + + def __init__( + self, + *, + source: Optional["UserSourceInfo"] = None, + deployment_settings: Optional["DeploymentSettings"] = None, + **kwargs + ): + """ + :keyword source: Uploaded source information of the deployment. + :paramtype source: ~azure.mgmt.appplatform.v2021_09_01_preview.models.UserSourceInfo + :keyword deployment_settings: Deployment settings of the Deployment. + :paramtype deployment_settings: + ~azure.mgmt.appplatform.v2021_09_01_preview.models.DeploymentSettings + """ + super(DeploymentResourceProperties, self).__init__(**kwargs) + self.source = source + self.app_name = None + self.deployment_settings = deployment_settings + self.provisioning_state = None + self.status = None + self.active = None + self.created_time = None + self.instances = None + + +class DeploymentSettings(msrest.serialization.Model): + """Deployment settings payload. + + :ivar 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-09-01-preview. Please use the + resourceRequests field to set the CPU size. + :vartype cpu: int + :ivar 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-09-01-preview. Please use the resourceRequests field to set the the memory size. + :vartype memory_in_gb: int + :ivar 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. + :vartype resource_requests: ~azure.mgmt.appplatform.v2021_09_01_preview.models.ResourceRequests + :ivar jvm_options: JVM parameter. + :vartype jvm_options: str + :ivar net_core_main_entry_path: The path to the .NET executable relative to zip root. + :vartype net_core_main_entry_path: str + :ivar environment_variables: Collection of environment variables. + :vartype environment_variables: dict[str, str] + :ivar runtime_version: Runtime version. Possible values include: "Java_8", "Java_11", + "NetCore_31". Default value: "Java_8". + :vartype runtime_version: str or + ~azure.mgmt.appplatform.v2021_09_01_preview.models.RuntimeVersion + :ivar container_probe_settings: Container liveness and readiness probe settings. + :vartype container_probe_settings: + ~azure.mgmt.appplatform.v2021_09_01_preview.models.DeploymentSettingsContainerProbeSettings + """ + + _attribute_map = { + 'cpu': {'key': 'cpu', 'type': 'int'}, + 'memory_in_gb': {'key': 'memoryInGB', 'type': 'int'}, + 'resource_requests': {'key': 'resourceRequests', 'type': 'ResourceRequests'}, + 'jvm_options': {'key': 'jvmOptions', 'type': 'str'}, + 'net_core_main_entry_path': {'key': 'netCoreMainEntryPath', 'type': 'str'}, + 'environment_variables': {'key': 'environmentVariables', 'type': '{str}'}, + 'runtime_version': {'key': 'runtimeVersion', 'type': 'str'}, + 'container_probe_settings': {'key': 'containerProbeSettings', 'type': 'DeploymentSettingsContainerProbeSettings'}, + } + + 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"]] = "Java_8", + container_probe_settings: Optional["DeploymentSettingsContainerProbeSettings"] = None, + **kwargs + ): + """ + :keyword 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-09-01-preview. Please use the + resourceRequests field to set the CPU size. + :paramtype cpu: int + :keyword 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-09-01-preview. Please use the resourceRequests field to set the the memory size. + :paramtype memory_in_gb: int + :keyword 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. + :paramtype resource_requests: + ~azure.mgmt.appplatform.v2021_09_01_preview.models.ResourceRequests + :keyword jvm_options: JVM parameter. + :paramtype jvm_options: str + :keyword net_core_main_entry_path: The path to the .NET executable relative to zip root. + :paramtype net_core_main_entry_path: str + :keyword environment_variables: Collection of environment variables. + :paramtype environment_variables: dict[str, str] + :keyword runtime_version: Runtime version. Possible values include: "Java_8", "Java_11", + "NetCore_31". Default value: "Java_8". + :paramtype runtime_version: str or + ~azure.mgmt.appplatform.v2021_09_01_preview.models.RuntimeVersion + :keyword container_probe_settings: Container liveness and readiness probe settings. + :paramtype container_probe_settings: + ~azure.mgmt.appplatform.v2021_09_01_preview.models.DeploymentSettingsContainerProbeSettings + """ + super(DeploymentSettings, self).__init__(**kwargs) + self.cpu = cpu + self.memory_in_gb = memory_in_gb + self.resource_requests = resource_requests + self.jvm_options = jvm_options + self.net_core_main_entry_path = net_core_main_entry_path + self.environment_variables = environment_variables + self.runtime_version = runtime_version + self.container_probe_settings = container_probe_settings + + +class DeploymentSettingsContainerProbeSettings(msrest.serialization.Model): + """Container liveness and readiness probe settings. + + :ivar disable_probe: Indicates whether disable the liveness and readiness probe. + :vartype disable_probe: bool + """ + + _attribute_map = { + 'disable_probe': {'key': 'disableProbe', 'type': 'bool'}, + } + + def __init__( + self, + *, + disable_probe: Optional[bool] = None, + **kwargs + ): + """ + :keyword disable_probe: Indicates whether disable the liveness and readiness probe. + :paramtype disable_probe: bool + """ + super(DeploymentSettingsContainerProbeSettings, self).__init__(**kwargs) + self.disable_probe = disable_probe + + +class DiagnosticParameters(msrest.serialization.Model): + """Diagnostic parameters of diagnostic operations. + + :ivar app_instance: App instance name. + :vartype app_instance: str + :ivar file_path: Your target file path in your own BYOS. + :vartype file_path: str + :ivar duration: Duration of your JFR. 1 min can be represented by 1m or 60s. + :vartype duration: str + """ + + _attribute_map = { + 'app_instance': {'key': 'appInstance', 'type': 'str'}, + 'file_path': {'key': 'filePath', 'type': 'str'}, + 'duration': {'key': 'duration', 'type': 'str'}, + } + + def __init__( + self, + *, + app_instance: Optional[str] = None, + file_path: Optional[str] = None, + duration: Optional[str] = None, + **kwargs + ): + """ + :keyword app_instance: App instance name. + :paramtype app_instance: str + :keyword file_path: Your target file path in your own BYOS. + :paramtype file_path: str + :keyword duration: Duration of your JFR. 1 min can be represented by 1m or 60s. + :paramtype duration: str + """ + super(DiagnosticParameters, self).__init__(**kwargs) + self.app_instance = app_instance + self.file_path = file_path + self.duration = duration + + +class Error(msrest.serialization.Model): + """The error code compose of code and message. + + :ivar code: The code of error. + :vartype code: str + :ivar message: The message of error. + :vartype message: str + """ + + _attribute_map = { + 'code': {'key': 'code', 'type': 'str'}, + 'message': {'key': 'message', 'type': 'str'}, + } + + def __init__( + self, + *, + code: Optional[str] = None, + message: Optional[str] = None, + **kwargs + ): + """ + :keyword code: The code of error. + :paramtype code: str + :keyword message: The message of error. + :paramtype message: str + """ + super(Error, self).__init__(**kwargs) + self.code = code + self.message = message + + +class GitPatternRepository(msrest.serialization.Model): + """Git repository property payload. + + All required parameters must be populated in order to send to Azure. + + :ivar name: Required. Name of the repository. + :vartype name: str + :ivar pattern: Collection of pattern of the repository. + :vartype pattern: list[str] + :ivar uri: Required. URI of the repository. + :vartype uri: str + :ivar label: Label of the repository. + :vartype label: str + :ivar search_paths: Searching path of the repository. + :vartype search_paths: list[str] + :ivar username: Username of git repository basic auth. + :vartype username: str + :ivar password: Password of git repository basic auth. + :vartype password: str + :ivar host_key: Public sshKey of git repository. + :vartype host_key: str + :ivar host_key_algorithm: SshKey algorithm of git repository. + :vartype host_key_algorithm: str + :ivar private_key: Private sshKey algorithm of git repository. + :vartype private_key: str + :ivar strict_host_key_checking: Strict host key checking or not. + :vartype strict_host_key_checking: bool + """ + + _validation = { + 'name': {'required': True}, + 'uri': {'required': True}, + } + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'pattern': {'key': 'pattern', 'type': '[str]'}, + 'uri': {'key': 'uri', 'type': 'str'}, + 'label': {'key': 'label', 'type': 'str'}, + 'search_paths': {'key': 'searchPaths', 'type': '[str]'}, + 'username': {'key': 'username', 'type': 'str'}, + 'password': {'key': 'password', 'type': 'str'}, + 'host_key': {'key': 'hostKey', 'type': 'str'}, + 'host_key_algorithm': {'key': 'hostKeyAlgorithm', 'type': 'str'}, + 'private_key': {'key': 'privateKey', 'type': 'str'}, + 'strict_host_key_checking': {'key': 'strictHostKeyChecking', 'type': 'bool'}, + } + + 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 + ): + """ + :keyword name: Required. Name of the repository. + :paramtype name: str + :keyword pattern: Collection of pattern of the repository. + :paramtype pattern: list[str] + :keyword uri: Required. URI of the repository. + :paramtype uri: str + :keyword label: Label of the repository. + :paramtype label: str + :keyword search_paths: Searching path of the repository. + :paramtype search_paths: list[str] + :keyword username: Username of git repository basic auth. + :paramtype username: str + :keyword password: Password of git repository basic auth. + :paramtype password: str + :keyword host_key: Public sshKey of git repository. + :paramtype host_key: str + :keyword host_key_algorithm: SshKey algorithm of git repository. + :paramtype host_key_algorithm: str + :keyword private_key: Private sshKey algorithm of git repository. + :paramtype private_key: str + :keyword strict_host_key_checking: Strict host key checking or not. + :paramtype strict_host_key_checking: bool + """ + super(GitPatternRepository, self).__init__(**kwargs) + self.name = name + self.pattern = pattern + self.uri = uri + self.label = label + self.search_paths = search_paths + self.username = username + self.password = password + self.host_key = host_key + self.host_key_algorithm = host_key_algorithm + self.private_key = private_key + self.strict_host_key_checking = strict_host_key_checking + + +class ImageRegistryCredential(msrest.serialization.Model): + """Credential of the image registry. + + :ivar username: The username of the image registry credential. + :vartype username: str + :ivar password: The password of the image registry credential. + :vartype 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 + ): + """ + :keyword username: The username of the image registry credential. + :paramtype username: str + :keyword password: The password of the image registry credential. + :paramtype password: str + """ + super(ImageRegistryCredential, self).__init__(**kwargs) + self.username = username + self.password = password + + +class KeyVaultCertificateProperties(CertificateProperties): + """Properties of certificate imported from key vault. + + 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. + + :ivar type: Required. The type of the certificate source.Constant filled by server. + :vartype type: str + :ivar thumbprint: The thumbprint of certificate. + :vartype thumbprint: str + :ivar issuer: The issuer of certificate. + :vartype issuer: str + :ivar issued_date: The issue date of certificate. + :vartype issued_date: str + :ivar expiration_date: The expiration date of certificate. + :vartype expiration_date: str + :ivar activate_date: The activate date of certificate. + :vartype activate_date: str + :ivar subject_name: The subject name of certificate. + :vartype subject_name: str + :ivar dns_names: The domain list of certificate. + :vartype dns_names: list[str] + :ivar vault_uri: Required. The vault uri of user key vault. + :vartype vault_uri: str + :ivar key_vault_cert_name: Required. The certificate name of key vault. + :vartype key_vault_cert_name: str + :ivar cert_version: The certificate version of key vault. + :vartype cert_version: str + :ivar exclude_private_key: Optional. If set to true, it will not import private key from key + vault. + :vartype exclude_private_key: bool + """ + + _validation = { + 'type': {'required': True}, + 'thumbprint': {'readonly': True}, + 'issuer': {'readonly': True}, + 'issued_date': {'readonly': True}, + 'expiration_date': {'readonly': True}, + 'activate_date': {'readonly': True}, + 'subject_name': {'readonly': True}, + 'dns_names': {'readonly': True}, + 'vault_uri': {'required': True}, + 'key_vault_cert_name': {'required': True}, + } + + _attribute_map = { + 'type': {'key': 'type', 'type': 'str'}, + 'thumbprint': {'key': 'thumbprint', 'type': 'str'}, + 'issuer': {'key': 'issuer', 'type': 'str'}, + 'issued_date': {'key': 'issuedDate', 'type': 'str'}, + 'expiration_date': {'key': 'expirationDate', 'type': 'str'}, + 'activate_date': {'key': 'activateDate', 'type': 'str'}, + 'subject_name': {'key': 'subjectName', 'type': 'str'}, + 'dns_names': {'key': 'dnsNames', 'type': '[str]'}, + 'vault_uri': {'key': 'vaultUri', 'type': 'str'}, + 'key_vault_cert_name': {'key': 'keyVaultCertName', 'type': 'str'}, + 'cert_version': {'key': 'certVersion', 'type': 'str'}, + 'exclude_private_key': {'key': 'excludePrivateKey', 'type': 'bool'}, + } + + def __init__( + self, + *, + vault_uri: str, + key_vault_cert_name: str, + cert_version: Optional[str] = None, + exclude_private_key: Optional[bool] = False, + **kwargs + ): + """ + :keyword vault_uri: Required. The vault uri of user key vault. + :paramtype vault_uri: str + :keyword key_vault_cert_name: Required. The certificate name of key vault. + :paramtype key_vault_cert_name: str + :keyword cert_version: The certificate version of key vault. + :paramtype cert_version: str + :keyword exclude_private_key: Optional. If set to true, it will not import private key from key + vault. + :paramtype exclude_private_key: bool + """ + super(KeyVaultCertificateProperties, self).__init__(**kwargs) + self.type = 'KeyVaultCertificate' # type: str + self.vault_uri = vault_uri + self.key_vault_cert_name = key_vault_cert_name + self.cert_version = cert_version + self.exclude_private_key = exclude_private_key + + +class LoadedCertificate(msrest.serialization.Model): + """Loaded certificate payload. + + All required parameters must be populated in order to send to Azure. + + :ivar resource_id: Required. Resource Id of loaded certificate. + :vartype resource_id: str + :ivar load_trust_store: Indicate whether the certificate will be loaded into default trust + store, only work for Java runtime. + :vartype load_trust_store: bool + """ + + _validation = { + 'resource_id': {'required': True}, + } + + _attribute_map = { + 'resource_id': {'key': 'resourceId', 'type': 'str'}, + 'load_trust_store': {'key': 'loadTrustStore', 'type': 'bool'}, + } + + def __init__( + self, + *, + resource_id: str, + load_trust_store: Optional[bool] = False, + **kwargs + ): + """ + :keyword resource_id: Required. Resource Id of loaded certificate. + :paramtype resource_id: str + :keyword load_trust_store: Indicate whether the certificate will be loaded into default trust + store, only work for Java runtime. + :paramtype load_trust_store: bool + """ + super(LoadedCertificate, self).__init__(**kwargs) + self.resource_id = resource_id + self.load_trust_store = load_trust_store + + +class LogFileUrlResponse(msrest.serialization.Model): + """Log file URL payload. + + All required parameters must be populated in order to send to Azure. + + :ivar url: Required. URL of the log file. + :vartype url: str + """ + + _validation = { + 'url': {'required': True}, + } + + _attribute_map = { + 'url': {'key': 'url', 'type': 'str'}, + } + + def __init__( + self, + *, + url: str, + **kwargs + ): + """ + :keyword url: Required. URL of the log file. + :paramtype url: str + """ + super(LogFileUrlResponse, self).__init__(**kwargs) + self.url = url + + +class LogSpecification(msrest.serialization.Model): + """Specifications of the Log for Azure Monitoring. + + :ivar name: Name of the log. + :vartype name: str + :ivar display_name: Localized friendly display name of the log. + :vartype display_name: str + :ivar blob_duration: Blob duration of the log. + :vartype blob_duration: str + """ + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'display_name': {'key': 'displayName', 'type': 'str'}, + 'blob_duration': {'key': 'blobDuration', 'type': 'str'}, + } + + def __init__( + self, + *, + name: Optional[str] = None, + display_name: Optional[str] = None, + blob_duration: Optional[str] = None, + **kwargs + ): + """ + :keyword name: Name of the log. + :paramtype name: str + :keyword display_name: Localized friendly display name of the log. + :paramtype display_name: str + :keyword blob_duration: Blob duration of the log. + :paramtype blob_duration: str + """ + super(LogSpecification, self).__init__(**kwargs) + self.name = name + self.display_name = display_name + self.blob_duration = blob_duration + + +class ManagedIdentityProperties(msrest.serialization.Model): + """Managed identity properties retrieved from ARM request headers. + + :ivar type: Type of the managed identity. Possible values include: "None", "SystemAssigned", + "UserAssigned", "SystemAssigned,UserAssigned". + :vartype type: str or ~azure.mgmt.appplatform.v2021_09_01_preview.models.ManagedIdentityType + :ivar principal_id: Principal Id. + :vartype principal_id: str + :ivar tenant_id: Tenant Id. + :vartype tenant_id: str + """ + + _attribute_map = { + 'type': {'key': 'type', 'type': 'str'}, + 'principal_id': {'key': 'principalId', 'type': 'str'}, + 'tenant_id': {'key': 'tenantId', 'type': 'str'}, + } + + def __init__( + self, + *, + type: Optional[Union[str, "ManagedIdentityType"]] = None, + principal_id: Optional[str] = None, + tenant_id: Optional[str] = None, + **kwargs + ): + """ + :keyword type: Type of the managed identity. Possible values include: "None", "SystemAssigned", + "UserAssigned", "SystemAssigned,UserAssigned". + :paramtype type: str or ~azure.mgmt.appplatform.v2021_09_01_preview.models.ManagedIdentityType + :keyword principal_id: Principal Id. + :paramtype principal_id: str + :keyword tenant_id: Tenant Id. + :paramtype tenant_id: str + """ + super(ManagedIdentityProperties, self).__init__(**kwargs) + self.type = type + self.principal_id = principal_id + self.tenant_id = tenant_id + + +class MetricDimension(msrest.serialization.Model): + """Specifications of the Dimension of metrics. + + :ivar name: Name of the dimension. + :vartype name: str + :ivar display_name: Localized friendly display name of the dimension. + :vartype display_name: str + :ivar to_be_exported_for_shoebox: Whether this dimension should be included for the Shoebox + export scenario. + :vartype 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: Optional[str] = None, + display_name: Optional[str] = None, + to_be_exported_for_shoebox: Optional[bool] = None, + **kwargs + ): + """ + :keyword name: Name of the dimension. + :paramtype name: str + :keyword display_name: Localized friendly display name of the dimension. + :paramtype display_name: str + :keyword to_be_exported_for_shoebox: Whether this dimension should be included for the Shoebox + export scenario. + :paramtype to_be_exported_for_shoebox: bool + """ + 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(msrest.serialization.Model): + """Specifications of the Metrics for Azure Monitoring. + + :ivar name: Name of the metric. + :vartype name: str + :ivar display_name: Localized friendly display name of the metric. + :vartype display_name: str + :ivar display_description: Localized friendly description of the metric. + :vartype display_description: str + :ivar unit: Unit that makes sense for the metric. + :vartype unit: str + :ivar category: Name of the metric category that the metric belongs to. A metric can only + belong to a single category. + :vartype category: str + :ivar aggregation_type: Only provide one value for this field. Valid values: Average, Minimum, + Maximum, Total, Count. + :vartype aggregation_type: str + :ivar supported_aggregation_types: Supported aggregation types. + :vartype supported_aggregation_types: list[str] + :ivar supported_time_grain_types: Supported time grain types. + :vartype supported_time_grain_types: list[str] + :ivar fill_gap_with_zero: Optional. If set to true, then zero will be returned for time + duration where no metric is emitted/published. + :vartype fill_gap_with_zero: bool + :ivar dimensions: Dimensions of the metric. + :vartype dimensions: list[~azure.mgmt.appplatform.v2021_09_01_preview.models.MetricDimension] + :ivar source_mdm_namespace: Name of the MDM namespace. Optional. + :vartype source_mdm_namespace: str + """ + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'display_name': {'key': 'displayName', 'type': 'str'}, + 'display_description': {'key': 'displayDescription', 'type': 'str'}, + 'unit': {'key': 'unit', 'type': 'str'}, + 'category': {'key': 'category', 'type': 'str'}, + 'aggregation_type': {'key': 'aggregationType', 'type': 'str'}, + 'supported_aggregation_types': {'key': 'supportedAggregationTypes', 'type': '[str]'}, + 'supported_time_grain_types': {'key': 'supportedTimeGrainTypes', 'type': '[str]'}, + 'fill_gap_with_zero': {'key': 'fillGapWithZero', 'type': 'bool'}, + 'dimensions': {'key': 'dimensions', 'type': '[MetricDimension]'}, + 'source_mdm_namespace': {'key': 'sourceMdmNamespace', 'type': 'str'}, + } + + 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, + source_mdm_namespace: Optional[str] = None, + **kwargs + ): + """ + :keyword name: Name of the metric. + :paramtype name: str + :keyword display_name: Localized friendly display name of the metric. + :paramtype display_name: str + :keyword display_description: Localized friendly description of the metric. + :paramtype display_description: str + :keyword unit: Unit that makes sense for the metric. + :paramtype unit: str + :keyword category: Name of the metric category that the metric belongs to. A metric can only + belong to a single category. + :paramtype category: str + :keyword aggregation_type: Only provide one value for this field. Valid values: Average, + Minimum, Maximum, Total, Count. + :paramtype aggregation_type: str + :keyword supported_aggregation_types: Supported aggregation types. + :paramtype supported_aggregation_types: list[str] + :keyword supported_time_grain_types: Supported time grain types. + :paramtype supported_time_grain_types: list[str] + :keyword fill_gap_with_zero: Optional. If set to true, then zero will be returned for time + duration where no metric is emitted/published. + :paramtype fill_gap_with_zero: bool + :keyword dimensions: Dimensions of the metric. + :paramtype dimensions: list[~azure.mgmt.appplatform.v2021_09_01_preview.models.MetricDimension] + :keyword source_mdm_namespace: Name of the MDM namespace. Optional. + :paramtype source_mdm_namespace: str + """ + super(MetricSpecification, self).__init__(**kwargs) + self.name = name + self.display_name = display_name + self.display_description = display_description + self.unit = unit + self.category = category + self.aggregation_type = aggregation_type + self.supported_aggregation_types = supported_aggregation_types + self.supported_time_grain_types = supported_time_grain_types + self.fill_gap_with_zero = fill_gap_with_zero + self.dimensions = dimensions + self.source_mdm_namespace = source_mdm_namespace + + +class MonitoringSettingProperties(msrest.serialization.Model): + """Monitoring Setting properties payload. + + 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". + :vartype provisioning_state: str or + ~azure.mgmt.appplatform.v2021_09_01_preview.models.MonitoringSettingState + :ivar error: Error when apply Monitoring Setting changes. + :vartype error: ~azure.mgmt.appplatform.v2021_09_01_preview.models.Error + :ivar 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. + :vartype trace_enabled: bool + :ivar app_insights_instrumentation_key: Target application insight instrumentation key, null or + whitespace include empty will disable monitoringSettings. + :vartype app_insights_instrumentation_key: str + :ivar app_insights_sampling_rate: Indicates the sampling rate of application insight agent, + should be in range [0.0, 100.0]. + :vartype app_insights_sampling_rate: float + :ivar app_insights_agent_versions: Indicates the versions of application insight agent. + :vartype app_insights_agent_versions: + ~azure.mgmt.appplatform.v2021_09_01_preview.models.ApplicationInsightsAgentVersions + """ + + _validation = { + 'provisioning_state': {'readonly': True}, + 'app_insights_sampling_rate': {'maximum': 100, 'minimum': 0}, + } + + _attribute_map = { + 'provisioning_state': {'key': 'provisioningState', 'type': 'str'}, + 'error': {'key': 'error', 'type': 'Error'}, + 'trace_enabled': {'key': 'traceEnabled', 'type': 'bool'}, + 'app_insights_instrumentation_key': {'key': 'appInsightsInstrumentationKey', 'type': 'str'}, + 'app_insights_sampling_rate': {'key': 'appInsightsSamplingRate', 'type': 'float'}, + 'app_insights_agent_versions': {'key': 'appInsightsAgentVersions', 'type': 'ApplicationInsightsAgentVersions'}, + } + + 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 + ): + """ + :keyword error: Error when apply Monitoring Setting changes. + :paramtype error: ~azure.mgmt.appplatform.v2021_09_01_preview.models.Error + :keyword 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. + :paramtype trace_enabled: bool + :keyword app_insights_instrumentation_key: Target application insight instrumentation key, null + or whitespace include empty will disable monitoringSettings. + :paramtype app_insights_instrumentation_key: str + :keyword app_insights_sampling_rate: Indicates the sampling rate of application insight agent, + should be in range [0.0, 100.0]. + :paramtype app_insights_sampling_rate: float + :keyword app_insights_agent_versions: Indicates the versions of application insight agent. + :paramtype app_insights_agent_versions: + ~azure.mgmt.appplatform.v2021_09_01_preview.models.ApplicationInsightsAgentVersions + """ + super(MonitoringSettingProperties, self).__init__(**kwargs) + self.provisioning_state = None + self.error = error + self.trace_enabled = trace_enabled + self.app_insights_instrumentation_key = app_insights_instrumentation_key + self.app_insights_sampling_rate = app_insights_sampling_rate + self.app_insights_agent_versions = app_insights_agent_versions + + +class MonitoringSettingResource(ProxyResource): + """Monitoring Setting resource. + + 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 + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. + :vartype type: str + :ivar properties: Properties of the Monitoring Setting resource. + :vartype properties: + ~azure.mgmt.appplatform.v2021_09_01_preview.models.MonitoringSettingProperties + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'properties': {'key': 'properties', 'type': 'MonitoringSettingProperties'}, + } + + def __init__( + self, + *, + properties: Optional["MonitoringSettingProperties"] = None, + **kwargs + ): + """ + :keyword properties: Properties of the Monitoring Setting resource. + :paramtype properties: + ~azure.mgmt.appplatform.v2021_09_01_preview.models.MonitoringSettingProperties + """ + super(MonitoringSettingResource, self).__init__(**kwargs) + self.properties = properties + + +class NameAvailability(msrest.serialization.Model): + """Name availability result payload. + + :ivar name_available: Indicates whether the name is available. + :vartype name_available: bool + :ivar reason: Reason why the name is not available. + :vartype reason: str + :ivar message: Message why the name is not available. + :vartype message: str + """ + + _attribute_map = { + 'name_available': {'key': 'nameAvailable', 'type': 'bool'}, + 'reason': {'key': 'reason', 'type': 'str'}, + 'message': {'key': 'message', 'type': 'str'}, + } + + def __init__( + self, + *, + name_available: Optional[bool] = None, + reason: Optional[str] = None, + message: Optional[str] = None, + **kwargs + ): + """ + :keyword name_available: Indicates whether the name is available. + :paramtype name_available: bool + :keyword reason: Reason why the name is not available. + :paramtype reason: str + :keyword message: Message why the name is not available. + :paramtype message: str + """ + super(NameAvailability, self).__init__(**kwargs) + self.name_available = name_available + self.reason = reason + self.message = message + + +class NameAvailabilityParameters(msrest.serialization.Model): + """Name availability parameters payload. + + All required parameters must be populated in order to send to Azure. + + :ivar type: Required. Type of the resource to check name availability. + :vartype type: str + :ivar name: Required. Name to be checked. + :vartype name: str + """ + + _validation = { + 'type': {'required': True}, + 'name': {'required': True}, + } + + _attribute_map = { + 'type': {'key': 'type', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + } + + def __init__( + self, + *, + type: str, + name: str, + **kwargs + ): + """ + :keyword type: Required. Type of the resource to check name availability. + :paramtype type: str + :keyword name: Required. Name to be checked. + :paramtype name: str + """ + super(NameAvailabilityParameters, self).__init__(**kwargs) + self.type = type + self.name = name + + +class NetworkProfile(msrest.serialization.Model): + """Service network profile payload. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar service_runtime_subnet_id: Fully qualified resource Id of the subnet to host Azure Spring + Cloud Service Runtime. + :vartype service_runtime_subnet_id: str + :ivar app_subnet_id: Fully qualified resource Id of the subnet to host Azure Spring Cloud Apps. + :vartype app_subnet_id: str + :ivar service_cidr: Azure Spring Cloud service reserved CIDR. + :vartype service_cidr: str + :ivar service_runtime_network_resource_group: Name of the resource group containing network + resources of Azure Spring Cloud Service Runtime. + :vartype service_runtime_network_resource_group: str + :ivar app_network_resource_group: Name of the resource group containing network resources of + Azure Spring Cloud Apps. + :vartype app_network_resource_group: str + :ivar outbound_i_ps: Desired outbound IP resources for Azure Spring Cloud instance. + :vartype outbound_i_ps: + ~azure.mgmt.appplatform.v2021_09_01_preview.models.NetworkProfileOutboundIPs + :ivar required_traffics: Required inbound or outbound traffics for Azure Spring Cloud instance. + :vartype required_traffics: + list[~azure.mgmt.appplatform.v2021_09_01_preview.models.RequiredTraffic] + """ + + _validation = { + 'outbound_i_ps': {'readonly': True}, + 'required_traffics': {'readonly': True}, + } + + _attribute_map = { + 'service_runtime_subnet_id': {'key': 'serviceRuntimeSubnetId', 'type': 'str'}, + 'app_subnet_id': {'key': 'appSubnetId', 'type': 'str'}, + 'service_cidr': {'key': 'serviceCidr', 'type': 'str'}, + 'service_runtime_network_resource_group': {'key': 'serviceRuntimeNetworkResourceGroup', 'type': 'str'}, + 'app_network_resource_group': {'key': 'appNetworkResourceGroup', 'type': 'str'}, + 'outbound_i_ps': {'key': 'outboundIPs', 'type': 'NetworkProfileOutboundIPs'}, + 'required_traffics': {'key': 'requiredTraffics', 'type': '[RequiredTraffic]'}, + } + + 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 + ): + """ + :keyword service_runtime_subnet_id: Fully qualified resource Id of the subnet to host Azure + Spring Cloud Service Runtime. + :paramtype service_runtime_subnet_id: str + :keyword app_subnet_id: Fully qualified resource Id of the subnet to host Azure Spring Cloud + Apps. + :paramtype app_subnet_id: str + :keyword service_cidr: Azure Spring Cloud service reserved CIDR. + :paramtype service_cidr: str + :keyword service_runtime_network_resource_group: Name of the resource group containing network + resources of Azure Spring Cloud Service Runtime. + :paramtype service_runtime_network_resource_group: str + :keyword app_network_resource_group: Name of the resource group containing network resources of + Azure Spring Cloud Apps. + :paramtype app_network_resource_group: str + """ + 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_i_ps = None + self.required_traffics = None + + +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. + + :ivar public_i_ps: A list of public IP addresses. + :vartype public_i_ps: list[str] + """ + + _validation = { + 'public_i_ps': {'readonly': True}, + } + + _attribute_map = { + 'public_i_ps': {'key': 'publicIPs', 'type': '[str]'}, + } + + def __init__( + self, + **kwargs + ): + """ + """ + super(NetworkProfileOutboundIPs, self).__init__(**kwargs) + self.public_i_ps = None + + +class OperationDetail(msrest.serialization.Model): + """Operation detail payload. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar name: Name of the operation. + :vartype name: str + :ivar is_data_action: Indicates whether the operation is a data action. + :vartype is_data_action: bool + :ivar display: Display of the operation. + :vartype display: ~azure.mgmt.appplatform.v2021_09_01_preview.models.OperationDisplay + :ivar action_type: Enum. Indicates the action type. "Internal" refers to actions that are for + internal only APIs. Possible values include: "Internal". + :vartype action_type: str or ~azure.mgmt.appplatform.v2021_09_01_preview.models.ActionType + :ivar origin: Origin of the operation. + :vartype origin: str + :ivar properties: Properties of the operation. + :vartype properties: ~azure.mgmt.appplatform.v2021_09_01_preview.models.OperationProperties + """ + + _validation = { + 'action_type': {'readonly': True}, + } + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'is_data_action': {'key': 'isDataAction', 'type': 'bool'}, + 'display': {'key': 'display', 'type': 'OperationDisplay'}, + 'action_type': {'key': 'actionType', 'type': 'str'}, + 'origin': {'key': 'origin', 'type': 'str'}, + 'properties': {'key': 'properties', 'type': 'OperationProperties'}, + } + + 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 + ): + """ + :keyword name: Name of the operation. + :paramtype name: str + :keyword is_data_action: Indicates whether the operation is a data action. + :paramtype is_data_action: bool + :keyword display: Display of the operation. + :paramtype display: ~azure.mgmt.appplatform.v2021_09_01_preview.models.OperationDisplay + :keyword origin: Origin of the operation. + :paramtype origin: str + :keyword properties: Properties of the operation. + :paramtype properties: ~azure.mgmt.appplatform.v2021_09_01_preview.models.OperationProperties + """ + super(OperationDetail, self).__init__(**kwargs) + self.name = name + self.is_data_action = is_data_action + self.display = display + self.action_type = None + self.origin = origin + self.properties = properties + + +class OperationDisplay(msrest.serialization.Model): + """Operation display payload. + + :ivar provider: Resource provider of the operation. + :vartype provider: str + :ivar resource: Resource of the operation. + :vartype resource: str + :ivar operation: Localized friendly name for the operation. + :vartype operation: str + :ivar description: Localized friendly description for the operation. + :vartype description: str + """ + + _attribute_map = { + 'provider': {'key': 'provider', 'type': 'str'}, + 'resource': {'key': 'resource', 'type': 'str'}, + 'operation': {'key': 'operation', 'type': 'str'}, + 'description': {'key': 'description', 'type': 'str'}, + } + + def __init__( + self, + *, + provider: Optional[str] = None, + resource: Optional[str] = None, + operation: Optional[str] = None, + description: Optional[str] = None, + **kwargs + ): + """ + :keyword provider: Resource provider of the operation. + :paramtype provider: str + :keyword resource: Resource of the operation. + :paramtype resource: str + :keyword operation: Localized friendly name for the operation. + :paramtype operation: str + :keyword description: Localized friendly description for the operation. + :paramtype description: str + """ + super(OperationDisplay, self).__init__(**kwargs) + self.provider = provider + self.resource = resource + self.operation = operation + self.description = description + + +class OperationProperties(msrest.serialization.Model): + """Extra Operation properties. + + :ivar service_specification: Service specifications of the operation. + :vartype service_specification: + ~azure.mgmt.appplatform.v2021_09_01_preview.models.ServiceSpecification + """ + + _attribute_map = { + 'service_specification': {'key': 'serviceSpecification', 'type': 'ServiceSpecification'}, + } + + def __init__( + self, + *, + service_specification: Optional["ServiceSpecification"] = None, + **kwargs + ): + """ + :keyword service_specification: Service specifications of the operation. + :paramtype service_specification: + ~azure.mgmt.appplatform.v2021_09_01_preview.models.ServiceSpecification + """ + super(OperationProperties, self).__init__(**kwargs) + self.service_specification = service_specification + + +class PersistentDisk(msrest.serialization.Model): + """Persistent disk payload. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar size_in_gb: Size of the persistent disk in GB. + :vartype size_in_gb: int + :ivar used_in_gb: Size of the used persistent disk in GB. + :vartype used_in_gb: int + :ivar mount_path: Mount path of the persistent disk. + :vartype mount_path: str + """ + + _validation = { + 'size_in_gb': {'maximum': 50, 'minimum': 0}, + 'used_in_gb': {'readonly': True, 'maximum': 50, 'minimum': 0}, + } + + _attribute_map = { + 'size_in_gb': {'key': 'sizeInGB', 'type': 'int'}, + 'used_in_gb': {'key': 'usedInGB', 'type': 'int'}, + 'mount_path': {'key': 'mountPath', 'type': 'str'}, + } + + def __init__( + self, + *, + size_in_gb: Optional[int] = None, + mount_path: Optional[str] = None, + **kwargs + ): + """ + :keyword size_in_gb: Size of the persistent disk in GB. + :paramtype size_in_gb: int + :keyword mount_path: Mount path of the persistent disk. + :paramtype mount_path: str + """ + super(PersistentDisk, self).__init__(**kwargs) + self.size_in_gb = size_in_gb + self.used_in_gb = None + self.mount_path = mount_path + + +class RegenerateTestKeyRequestPayload(msrest.serialization.Model): + """Regenerate test key request payload. + + All required parameters must be populated in order to send to Azure. + + :ivar key_type: Required. Type of the test key. Possible values include: "Primary", + "Secondary". + :vartype key_type: str or ~azure.mgmt.appplatform.v2021_09_01_preview.models.TestKeyType + """ + + _validation = { + 'key_type': {'required': True}, + } + + _attribute_map = { + 'key_type': {'key': 'keyType', 'type': 'str'}, + } + + def __init__( + self, + *, + key_type: Union[str, "TestKeyType"], + **kwargs + ): + """ + :keyword key_type: Required. Type of the test key. Possible values include: "Primary", + "Secondary". + :paramtype key_type: str or ~azure.mgmt.appplatform.v2021_09_01_preview.models.TestKeyType + """ + super(RegenerateTestKeyRequestPayload, self).__init__(**kwargs) + self.key_type = key_type + + +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. + + :ivar protocol: The protocol of required traffic. + :vartype protocol: str + :ivar port: The port of required traffic. + :vartype port: int + :ivar ips: The ip list of required traffic. + :vartype ips: list[str] + :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_09_01_preview.models.TrafficDirection + """ + + _validation = { + 'protocol': {'readonly': True}, + 'port': {'readonly': True}, + 'ips': {'readonly': True}, + 'fqdns': {'readonly': True}, + 'direction': {'readonly': True}, + } + + _attribute_map = { + 'protocol': {'key': 'protocol', 'type': 'str'}, + 'port': {'key': 'port', 'type': 'int'}, + 'ips': {'key': 'ips', 'type': '[str]'}, + 'fqdns': {'key': 'fqdns', 'type': '[str]'}, + 'direction': {'key': 'direction', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + """ + """ + super(RequiredTraffic, self).__init__(**kwargs) + self.protocol = None + self.port = None + self.ips = None + self.fqdns = None + self.direction = None + + +class ResourceRequests(msrest.serialization.Model): + """Deployment resource request payload. + + :ivar 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. + :vartype cpu: str + :ivar 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. + :vartype memory: str + """ + + _attribute_map = { + 'cpu': {'key': 'cpu', 'type': 'str'}, + 'memory': {'key': 'memory', 'type': 'str'}, + } + + def __init__( + self, + *, + cpu: Optional[str] = None, + memory: Optional[str] = None, + **kwargs + ): + """ + :keyword 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. + :paramtype cpu: str + :keyword 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. + :paramtype memory: str + """ + super(ResourceRequests, self).__init__(**kwargs) + self.cpu = cpu + self.memory = memory + + +class ResourceSku(msrest.serialization.Model): + """Describes an available Azure Spring Cloud SKU. + + :ivar resource_type: Gets the type of resource the SKU applies to. + :vartype resource_type: str + :ivar name: Gets the name of SKU. + :vartype name: str + :ivar tier: Gets the tier of SKU. + :vartype tier: str + :ivar capacity: Gets the capacity of SKU. + :vartype capacity: ~azure.mgmt.appplatform.v2021_09_01_preview.models.SkuCapacity + :ivar locations: Gets the set of locations that the SKU is available. + :vartype locations: list[str] + :ivar location_info: Gets a list of locations and availability zones in those locations where + the SKU is available. + :vartype location_info: + list[~azure.mgmt.appplatform.v2021_09_01_preview.models.ResourceSkuLocationInfo] + :ivar restrictions: Gets the restrictions because of which SKU cannot be used. This is + empty if there are no restrictions. + :vartype restrictions: + list[~azure.mgmt.appplatform.v2021_09_01_preview.models.ResourceSkuRestrictions] + """ + + _attribute_map = { + 'resource_type': {'key': 'resourceType', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'tier': {'key': 'tier', 'type': 'str'}, + 'capacity': {'key': 'capacity', 'type': 'SkuCapacity'}, + 'locations': {'key': 'locations', 'type': '[str]'}, + 'location_info': {'key': 'locationInfo', 'type': '[ResourceSkuLocationInfo]'}, + 'restrictions': {'key': 'restrictions', 'type': '[ResourceSkuRestrictions]'}, + } + + 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 + ): + """ + :keyword resource_type: Gets the type of resource the SKU applies to. + :paramtype resource_type: str + :keyword name: Gets the name of SKU. + :paramtype name: str + :keyword tier: Gets the tier of SKU. + :paramtype tier: str + :keyword capacity: Gets the capacity of SKU. + :paramtype capacity: ~azure.mgmt.appplatform.v2021_09_01_preview.models.SkuCapacity + :keyword locations: Gets the set of locations that the SKU is available. + :paramtype locations: list[str] + :keyword location_info: Gets a list of locations and availability zones in those locations + where the SKU is available. + :paramtype location_info: + list[~azure.mgmt.appplatform.v2021_09_01_preview.models.ResourceSkuLocationInfo] + :keyword restrictions: Gets the restrictions because of which SKU cannot be used. This is + empty if there are no restrictions. + :paramtype restrictions: + list[~azure.mgmt.appplatform.v2021_09_01_preview.models.ResourceSkuRestrictions] + """ + super(ResourceSku, self).__init__(**kwargs) + self.resource_type = resource_type + self.name = name + self.tier = tier + self.capacity = capacity + self.locations = locations + self.location_info = location_info + self.restrictions = restrictions + + +class ResourceSkuCapabilities(msrest.serialization.Model): + """ResourceSkuCapabilities. + + :ivar name: Gets an invariant to describe the feature. + :vartype name: str + :ivar value: Gets an invariant if the feature is measured by quantity. + :vartype value: str + """ + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'value': {'key': 'value', 'type': 'str'}, + } + + def __init__( + self, + *, + name: Optional[str] = None, + value: Optional[str] = None, + **kwargs + ): + """ + :keyword name: Gets an invariant to describe the feature. + :paramtype name: str + :keyword value: Gets an invariant if the feature is measured by quantity. + :paramtype value: str + """ + super(ResourceSkuCapabilities, self).__init__(**kwargs) + self.name = name + self.value = value + + +class ResourceSkuCollection(msrest.serialization.Model): + """Object that includes an array of Azure Spring Cloud SKU and a possible link for next set. + + :ivar value: Collection of resource SKU. + :vartype value: list[~azure.mgmt.appplatform.v2021_09_01_preview.models.ResourceSku] + :ivar next_link: URL client should use to fetch the next page (per server side paging). + It's null for now, added for future use. + :vartype 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 + ): + """ + :keyword value: Collection of resource SKU. + :paramtype value: list[~azure.mgmt.appplatform.v2021_09_01_preview.models.ResourceSku] + :keyword next_link: URL client should use to fetch the next page (per server side paging). + It's null for now, added for future use. + :paramtype next_link: str + """ + 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. + + :ivar location: Gets location of the SKU. + :vartype location: str + :ivar zones: Gets list of availability zones where the SKU is supported. + :vartype zones: list[str] + :ivar zone_details: Gets details of capabilities available to a SKU in specific zones. + :vartype zone_details: + list[~azure.mgmt.appplatform.v2021_09_01_preview.models.ResourceSkuZoneDetails] + """ + + _attribute_map = { + 'location': {'key': 'location', 'type': 'str'}, + 'zones': {'key': 'zones', 'type': '[str]'}, + 'zone_details': {'key': 'zoneDetails', 'type': '[ResourceSkuZoneDetails]'}, + } + + def __init__( + self, + *, + location: Optional[str] = None, + zones: Optional[List[str]] = None, + zone_details: Optional[List["ResourceSkuZoneDetails"]] = None, + **kwargs + ): + """ + :keyword location: Gets location of the SKU. + :paramtype location: str + :keyword zones: Gets list of availability zones where the SKU is supported. + :paramtype zones: list[str] + :keyword zone_details: Gets details of capabilities available to a SKU in specific zones. + :paramtype zone_details: + list[~azure.mgmt.appplatform.v2021_09_01_preview.models.ResourceSkuZoneDetails] + """ + super(ResourceSkuLocationInfo, self).__init__(**kwargs) + self.location = location + self.zones = zones + self.zone_details = zone_details + + +class ResourceSkuRestrictionInfo(msrest.serialization.Model): + """Information about the restriction where the SKU cannot be used. + + :ivar locations: Gets locations where the SKU is restricted. + :vartype locations: list[str] + :ivar zones: Gets list of availability zones where the SKU is restricted. + :vartype zones: list[str] + """ + + _attribute_map = { + 'locations': {'key': 'locations', 'type': '[str]'}, + 'zones': {'key': 'zones', 'type': '[str]'}, + } + + def __init__( + self, + *, + locations: Optional[List[str]] = None, + zones: Optional[List[str]] = None, + **kwargs + ): + """ + :keyword locations: Gets locations where the SKU is restricted. + :paramtype locations: list[str] + :keyword zones: Gets list of availability zones where the SKU is restricted. + :paramtype zones: list[str] + """ + super(ResourceSkuRestrictionInfo, self).__init__(**kwargs) + self.locations = locations + self.zones = zones + + +class ResourceSkuRestrictions(msrest.serialization.Model): + """Restrictions where the SKU cannot be used. + + :ivar type: Gets the type of restrictions. Possible values include: 'Location', 'Zone'. + Possible values include: "Location", "Zone". + :vartype type: str or + ~azure.mgmt.appplatform.v2021_09_01_preview.models.ResourceSkuRestrictionsType + :ivar values: Gets the value of restrictions. If the restriction type is set to + location. This would be different locations where the SKU is restricted. + :vartype values: list[str] + :ivar restriction_info: Gets the information about the restriction where the SKU cannot be + used. + :vartype restriction_info: + ~azure.mgmt.appplatform.v2021_09_01_preview.models.ResourceSkuRestrictionInfo + :ivar reason_code: Gets the reason for restriction. Possible values include: 'QuotaId', + 'NotAvailableForSubscription'. Possible values include: "QuotaId", + "NotAvailableForSubscription". + :vartype reason_code: str or + ~azure.mgmt.appplatform.v2021_09_01_preview.models.ResourceSkuRestrictionsReasonCode + """ + + _attribute_map = { + 'type': {'key': 'type', 'type': 'str'}, + 'values': {'key': 'values', 'type': '[str]'}, + 'restriction_info': {'key': 'restrictionInfo', 'type': 'ResourceSkuRestrictionInfo'}, + 'reason_code': {'key': 'reasonCode', 'type': 'str'}, + } + + 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 + ): + """ + :keyword type: Gets the type of restrictions. Possible values include: 'Location', 'Zone'. + Possible values include: "Location", "Zone". + :paramtype type: str or + ~azure.mgmt.appplatform.v2021_09_01_preview.models.ResourceSkuRestrictionsType + :keyword values: Gets the value of restrictions. If the restriction type is set to + location. This would be different locations where the SKU is restricted. + :paramtype values: list[str] + :keyword restriction_info: Gets the information about the restriction where the SKU cannot be + used. + :paramtype restriction_info: + ~azure.mgmt.appplatform.v2021_09_01_preview.models.ResourceSkuRestrictionInfo + :keyword reason_code: Gets the reason for restriction. Possible values include: 'QuotaId', + 'NotAvailableForSubscription'. Possible values include: "QuotaId", + "NotAvailableForSubscription". + :paramtype reason_code: str or + ~azure.mgmt.appplatform.v2021_09_01_preview.models.ResourceSkuRestrictionsReasonCode + """ + super(ResourceSkuRestrictions, self).__init__(**kwargs) + self.type = type + self.values = values + self.restriction_info = restriction_info + self.reason_code = reason_code + + +class ResourceSkuZoneDetails(msrest.serialization.Model): + """Details of capabilities available to a SKU in specific zones. + + :ivar name: Gets the set of zones that the SKU is available in with the + specified capabilities. + :vartype name: list[str] + :ivar capabilities: Gets a list of capabilities that are available for the SKU in the + specified list of zones. + :vartype capabilities: + list[~azure.mgmt.appplatform.v2021_09_01_preview.models.ResourceSkuCapabilities] + """ + + _attribute_map = { + 'name': {'key': 'name', 'type': '[str]'}, + 'capabilities': {'key': 'capabilities', 'type': '[ResourceSkuCapabilities]'}, + } + + def __init__( + self, + *, + name: Optional[List[str]] = None, + capabilities: Optional[List["ResourceSkuCapabilities"]] = None, + **kwargs + ): + """ + :keyword name: Gets the set of zones that the SKU is available in with the + specified capabilities. + :paramtype name: list[str] + :keyword capabilities: Gets a list of capabilities that are available for the SKU in the + specified list of zones. + :paramtype capabilities: + list[~azure.mgmt.appplatform.v2021_09_01_preview.models.ResourceSkuCapabilities] + """ + super(ResourceSkuZoneDetails, self).__init__(**kwargs) + self.name = name + self.capabilities = capabilities + + +class ResourceUploadDefinition(msrest.serialization.Model): + """Resource upload definition payload. + + :ivar relative_path: Source relative path. + :vartype relative_path: str + :ivar upload_url: Upload URL. + :vartype upload_url: str + """ + + _attribute_map = { + 'relative_path': {'key': 'relativePath', 'type': 'str'}, + 'upload_url': {'key': 'uploadUrl', 'type': 'str'}, + } + + def __init__( + self, + *, + relative_path: Optional[str] = None, + upload_url: Optional[str] = None, + **kwargs + ): + """ + :keyword relative_path: Source relative path. + :paramtype relative_path: str + :keyword upload_url: Upload URL. + :paramtype upload_url: str + """ + super(ResourceUploadDefinition, self).__init__(**kwargs) + self.relative_path = relative_path + self.upload_url = upload_url + + +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. + + :ivar id: Fully qualified resource Id for the resource. + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. + :vartype type: str + :ivar location: The GEO location of the resource. + :vartype location: str + :ivar tags: A set of tags. Tags of the service which is a list of key value pairs that describe + the resource. + :vartype tags: dict[str, str] + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'location': {'key': 'location', 'type': 'str'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + } + + def __init__( + self, + *, + location: Optional[str] = None, + tags: Optional[Dict[str, str]] = None, + **kwargs + ): + """ + :keyword location: The GEO location of the resource. + :paramtype location: str + :keyword tags: A set of tags. Tags of the service which is a list of key value pairs that + describe the resource. + :paramtype tags: dict[str, str] + """ + super(TrackedResource, self).__init__(**kwargs) + self.location = location + self.tags = tags + + +class ServiceResource(TrackedResource): + """Service resource. + + 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 + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. + :vartype type: str + :ivar location: The GEO location of the resource. + :vartype location: str + :ivar tags: A set of tags. Tags of the service which is a list of key value pairs that describe + the resource. + :vartype tags: dict[str, str] + :ivar properties: Properties of the Service resource. + :vartype properties: + ~azure.mgmt.appplatform.v2021_09_01_preview.models.ClusterResourceProperties + :ivar sku: Sku of the Service resource. + :vartype sku: ~azure.mgmt.appplatform.v2021_09_01_preview.models.Sku + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'location': {'key': 'location', 'type': 'str'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + 'properties': {'key': 'properties', 'type': 'ClusterResourceProperties'}, + 'sku': {'key': 'sku', 'type': 'Sku'}, + } + + def __init__( + self, + *, + location: Optional[str] = None, + tags: Optional[Dict[str, str]] = None, + properties: Optional["ClusterResourceProperties"] = None, + sku: Optional["Sku"] = None, + **kwargs + ): + """ + :keyword location: The GEO location of the resource. + :paramtype location: str + :keyword tags: A set of tags. Tags of the service which is a list of key value pairs that + describe the resource. + :paramtype tags: dict[str, str] + :keyword properties: Properties of the Service resource. + :paramtype properties: + ~azure.mgmt.appplatform.v2021_09_01_preview.models.ClusterResourceProperties + :keyword sku: Sku of the Service resource. + :paramtype sku: ~azure.mgmt.appplatform.v2021_09_01_preview.models.Sku + """ + super(ServiceResource, self).__init__(location=location, tags=tags, **kwargs) + self.properties = properties + self.sku = sku + + +class ServiceResourceList(msrest.serialization.Model): + """Object that includes an array of Service resources and a possible link for next set. + + :ivar value: Collection of Service resources. + :vartype value: list[~azure.mgmt.appplatform.v2021_09_01_preview.models.ServiceResource] + :ivar next_link: URL client should use to fetch the next page (per server side paging). + It's null for now, added for future use. + :vartype 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 + ): + """ + :keyword value: Collection of Service resources. + :paramtype value: list[~azure.mgmt.appplatform.v2021_09_01_preview.models.ServiceResource] + :keyword next_link: URL client should use to fetch the next page (per server side paging). + It's null for now, added for future use. + :paramtype next_link: str + """ + super(ServiceResourceList, self).__init__(**kwargs) + self.value = value + self.next_link = next_link + + +class ServiceSpecification(msrest.serialization.Model): + """Service specification payload. + + :ivar log_specifications: Specifications of the Log for Azure Monitoring. + :vartype log_specifications: + list[~azure.mgmt.appplatform.v2021_09_01_preview.models.LogSpecification] + :ivar metric_specifications: Specifications of the Metrics for Azure Monitoring. + :vartype metric_specifications: + list[~azure.mgmt.appplatform.v2021_09_01_preview.models.MetricSpecification] + """ + + _attribute_map = { + 'log_specifications': {'key': 'logSpecifications', 'type': '[LogSpecification]'}, + 'metric_specifications': {'key': 'metricSpecifications', 'type': '[MetricSpecification]'}, + } + + def __init__( + self, + *, + log_specifications: Optional[List["LogSpecification"]] = None, + metric_specifications: Optional[List["MetricSpecification"]] = None, + **kwargs + ): + """ + :keyword log_specifications: Specifications of the Log for Azure Monitoring. + :paramtype log_specifications: + list[~azure.mgmt.appplatform.v2021_09_01_preview.models.LogSpecification] + :keyword metric_specifications: Specifications of the Metrics for Azure Monitoring. + :paramtype metric_specifications: + list[~azure.mgmt.appplatform.v2021_09_01_preview.models.MetricSpecification] + """ + super(ServiceSpecification, self).__init__(**kwargs) + self.log_specifications = log_specifications + self.metric_specifications = metric_specifications + + +class Sku(msrest.serialization.Model): + """Sku of Azure Spring Cloud. + + :ivar name: Name of the Sku. + :vartype name: str + :ivar tier: Tier of the Sku. + :vartype tier: str + :ivar capacity: Current capacity of the target resource. + :vartype capacity: int + """ + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'tier': {'key': 'tier', 'type': 'str'}, + 'capacity': {'key': 'capacity', 'type': 'int'}, + } + + def __init__( + self, + *, + name: Optional[str] = "S0", + tier: Optional[str] = "Standard", + capacity: Optional[int] = None, + **kwargs + ): + """ + :keyword name: Name of the Sku. + :paramtype name: str + :keyword tier: Tier of the Sku. + :paramtype tier: str + :keyword capacity: Current capacity of the target resource. + :paramtype capacity: int + """ + super(Sku, self).__init__(**kwargs) + self.name = name + self.tier = tier + self.capacity = capacity + + +class SkuCapacity(msrest.serialization.Model): + """The SKU capacity. + + All required parameters must be populated in order to send to Azure. + + :ivar minimum: Required. Gets or sets the minimum. + :vartype minimum: int + :ivar maximum: Gets or sets the maximum. + :vartype maximum: int + :ivar default: Gets or sets the default. + :vartype default: int + :ivar scale_type: Gets or sets the type of the scale. Possible values include: "None", + "Manual", "Automatic". + :vartype scale_type: str or ~azure.mgmt.appplatform.v2021_09_01_preview.models.SkuScaleType + """ + + _validation = { + 'minimum': {'required': True}, + } + + _attribute_map = { + 'minimum': {'key': 'minimum', 'type': 'int'}, + 'maximum': {'key': 'maximum', 'type': 'int'}, + 'default': {'key': 'default', 'type': 'int'}, + 'scale_type': {'key': 'scaleType', 'type': 'str'}, + } + + def __init__( + self, + *, + minimum: int, + maximum: Optional[int] = None, + default: Optional[int] = None, + scale_type: Optional[Union[str, "SkuScaleType"]] = None, + **kwargs + ): + """ + :keyword minimum: Required. Gets or sets the minimum. + :paramtype minimum: int + :keyword maximum: Gets or sets the maximum. + :paramtype maximum: int + :keyword default: Gets or sets the default. + :paramtype default: int + :keyword scale_type: Gets or sets the type of the scale. Possible values include: "None", + "Manual", "Automatic". + :paramtype scale_type: str or ~azure.mgmt.appplatform.v2021_09_01_preview.models.SkuScaleType + """ + super(SkuCapacity, self).__init__(**kwargs) + self.minimum = minimum + self.maximum = maximum + self.default = default + self.scale_type = scale_type + + +class StorageProperties(msrest.serialization.Model): + """Storage resource payload. + + You probably want to use the sub-classes and not this class directly. Known + sub-classes are: StorageAccount. + + All required parameters must be populated in order to send to Azure. + + :ivar storage_type: Required. The type of the storage.Constant filled by server. + :vartype storage_type: str + """ + + _validation = { + 'storage_type': {'required': True}, + } + + _attribute_map = { + 'storage_type': {'key': 'storageType', 'type': 'str'}, + } + + _subtype_map = { + 'storage_type': {'StorageAccount': 'StorageAccount'} + } + + def __init__( + self, + **kwargs + ): + """ + """ + super(StorageProperties, self).__init__(**kwargs) + self.storage_type = None # type: Optional[str] + + +class StorageAccount(StorageProperties): + """storage resource of type Azure Storage Account. + + All required parameters must be populated in order to send to Azure. + + :ivar storage_type: Required. The type of the storage.Constant filled by server. + :vartype storage_type: str + :ivar account_name: Required. The account name of the Azure Storage Account. + :vartype account_name: str + :ivar account_key: Required. The account key of the Azure Storage Account. + :vartype account_key: str + """ + + _validation = { + 'storage_type': {'required': True}, + 'account_name': {'required': True}, + 'account_key': {'required': True}, + } + + _attribute_map = { + 'storage_type': {'key': 'storageType', 'type': 'str'}, + 'account_name': {'key': 'accountName', 'type': 'str'}, + 'account_key': {'key': 'accountKey', 'type': 'str'}, + } + + def __init__( + self, + *, + account_name: str, + account_key: str, + **kwargs + ): + """ + :keyword account_name: Required. The account name of the Azure Storage Account. + :paramtype account_name: str + :keyword account_key: Required. The account key of the Azure Storage Account. + :paramtype account_key: str + """ + super(StorageAccount, self).__init__(**kwargs) + self.storage_type = 'StorageAccount' # type: str + self.account_name = account_name + self.account_key = account_key + + +class StorageResource(ProxyResource): + """Storage resource payload. + + 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 + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. + :vartype type: str + :ivar properties: Properties of the storage resource payload. + :vartype properties: ~azure.mgmt.appplatform.v2021_09_01_preview.models.StorageProperties + :ivar system_data: Metadata pertaining to creation and last modification of the resource. + :vartype system_data: ~azure.mgmt.appplatform.v2021_09_01_preview.models.SystemData + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'system_data': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'properties': {'key': 'properties', 'type': 'StorageProperties'}, + 'system_data': {'key': 'systemData', 'type': 'SystemData'}, + } + + def __init__( + self, + *, + properties: Optional["StorageProperties"] = None, + **kwargs + ): + """ + :keyword properties: Properties of the storage resource payload. + :paramtype properties: ~azure.mgmt.appplatform.v2021_09_01_preview.models.StorageProperties + """ + super(StorageResource, self).__init__(**kwargs) + self.properties = properties + self.system_data = None + + +class StorageResourceCollection(msrest.serialization.Model): + """Collection compose of storage resources list and a possible link for next page. + + :ivar value: The storage resources list. + :vartype value: list[~azure.mgmt.appplatform.v2021_09_01_preview.models.StorageResource] + :ivar next_link: The link to next page of storage list. + :vartype next_link: str + """ + + _attribute_map = { + 'value': {'key': 'value', 'type': '[StorageResource]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + *, + value: Optional[List["StorageResource"]] = None, + next_link: Optional[str] = None, + **kwargs + ): + """ + :keyword value: The storage resources list. + :paramtype value: list[~azure.mgmt.appplatform.v2021_09_01_preview.models.StorageResource] + :keyword next_link: The link to next page of storage list. + :paramtype next_link: str + """ + super(StorageResourceCollection, self).__init__(**kwargs) + self.value = value + self.next_link = next_link + + +class SupportedRuntimeVersion(msrest.serialization.Model): + """Supported deployment runtime version descriptor. + + :ivar value: The raw value which could be passed to deployment CRUD operations. Possible values + include: "Java_8", "Java_11", "NetCore_31". + :vartype value: str or ~azure.mgmt.appplatform.v2021_09_01_preview.models.SupportedRuntimeValue + :ivar platform: The platform of this runtime version (possible values: "Java" or ".NET"). + Possible values include: "Java", ".NET Core". + :vartype platform: str or + ~azure.mgmt.appplatform.v2021_09_01_preview.models.SupportedRuntimePlatform + :ivar version: The detailed version (major.minor) of the platform. + :vartype version: str + """ + + _attribute_map = { + 'value': {'key': 'value', 'type': 'str'}, + 'platform': {'key': 'platform', 'type': 'str'}, + 'version': {'key': 'version', 'type': 'str'}, + } + + def __init__( + self, + *, + value: Optional[Union[str, "SupportedRuntimeValue"]] = None, + platform: Optional[Union[str, "SupportedRuntimePlatform"]] = None, + version: Optional[str] = None, + **kwargs + ): + """ + :keyword value: The raw value which could be passed to deployment CRUD operations. Possible + values include: "Java_8", "Java_11", "NetCore_31". + :paramtype value: str or + ~azure.mgmt.appplatform.v2021_09_01_preview.models.SupportedRuntimeValue + :keyword platform: The platform of this runtime version (possible values: "Java" or ".NET"). + Possible values include: "Java", ".NET Core". + :paramtype platform: str or + ~azure.mgmt.appplatform.v2021_09_01_preview.models.SupportedRuntimePlatform + :keyword version: The detailed version (major.minor) of the platform. + :paramtype version: str + """ + super(SupportedRuntimeVersion, self).__init__(**kwargs) + self.value = value + self.platform = platform + self.version = version + + +class SystemData(msrest.serialization.Model): + """Metadata pertaining to creation and last modification of the resource. + + :ivar created_by: The identity that created the resource. + :vartype created_by: str + :ivar created_by_type: The type of identity that created the resource. Possible values include: + "User", "Application", "ManagedIdentity", "Key". + :vartype created_by_type: str or + ~azure.mgmt.appplatform.v2021_09_01_preview.models.CreatedByType + :ivar created_at: The timestamp of resource creation (UTC). + :vartype created_at: ~datetime.datetime + :ivar last_modified_by: The identity that last modified the resource. + :vartype last_modified_by: str + :ivar last_modified_by_type: The type of identity that last modified the resource. Possible + values include: "User", "Application", "ManagedIdentity", "Key". + :vartype last_modified_by_type: str or + ~azure.mgmt.appplatform.v2021_09_01_preview.models.CreatedByType + :ivar last_modified_at: The timestamp of resource last modification (UTC). + :vartype last_modified_at: ~datetime.datetime + """ + + _attribute_map = { + 'created_by': {'key': 'createdBy', 'type': 'str'}, + 'created_by_type': {'key': 'createdByType', 'type': 'str'}, + 'created_at': {'key': 'createdAt', 'type': 'iso-8601'}, + 'last_modified_by': {'key': 'lastModifiedBy', 'type': 'str'}, + 'last_modified_by_type': {'key': 'lastModifiedByType', 'type': 'str'}, + 'last_modified_at': {'key': 'lastModifiedAt', 'type': 'iso-8601'}, + } + + def __init__( + self, + *, + created_by: Optional[str] = None, + created_by_type: Optional[Union[str, "CreatedByType"]] = None, + created_at: Optional[datetime.datetime] = None, + last_modified_by: Optional[str] = None, + last_modified_by_type: Optional[Union[str, "CreatedByType"]] = None, + last_modified_at: Optional[datetime.datetime] = None, + **kwargs + ): + """ + :keyword created_by: The identity that created the resource. + :paramtype created_by: str + :keyword created_by_type: The type of identity that created the resource. Possible values + include: "User", "Application", "ManagedIdentity", "Key". + :paramtype created_by_type: str or + ~azure.mgmt.appplatform.v2021_09_01_preview.models.CreatedByType + :keyword created_at: The timestamp of resource creation (UTC). + :paramtype created_at: ~datetime.datetime + :keyword last_modified_by: The identity that last modified the resource. + :paramtype last_modified_by: str + :keyword last_modified_by_type: The type of identity that last modified the resource. Possible + values include: "User", "Application", "ManagedIdentity", "Key". + :paramtype last_modified_by_type: str or + ~azure.mgmt.appplatform.v2021_09_01_preview.models.CreatedByType + :keyword last_modified_at: The timestamp of resource last modification (UTC). + :paramtype last_modified_at: ~datetime.datetime + """ + super(SystemData, self).__init__(**kwargs) + self.created_by = created_by + self.created_by_type = created_by_type + self.created_at = created_at + self.last_modified_by = last_modified_by + self.last_modified_by_type = last_modified_by_type + self.last_modified_at = last_modified_at + + +class TemporaryDisk(msrest.serialization.Model): + """Temporary disk payload. + + :ivar size_in_gb: Size of the temporary disk in GB. + :vartype size_in_gb: int + :ivar mount_path: Mount path of the temporary disk. + :vartype mount_path: str + """ + + _validation = { + 'size_in_gb': {'maximum': 5, 'minimum': 0}, + } + + _attribute_map = { + 'size_in_gb': {'key': 'sizeInGB', 'type': 'int'}, + 'mount_path': {'key': 'mountPath', 'type': 'str'}, + } + + def __init__( + self, + *, + size_in_gb: Optional[int] = None, + mount_path: Optional[str] = "/tmp", + **kwargs + ): + """ + :keyword size_in_gb: Size of the temporary disk in GB. + :paramtype size_in_gb: int + :keyword mount_path: Mount path of the temporary disk. + :paramtype mount_path: str + """ + super(TemporaryDisk, self).__init__(**kwargs) + self.size_in_gb = size_in_gb + self.mount_path = mount_path + + +class TestKeys(msrest.serialization.Model): + """Test keys payload. + + :ivar primary_key: Primary key. + :vartype primary_key: str + :ivar secondary_key: Secondary key. + :vartype secondary_key: str + :ivar primary_test_endpoint: Primary test endpoint. + :vartype primary_test_endpoint: str + :ivar secondary_test_endpoint: Secondary test endpoint. + :vartype secondary_test_endpoint: str + :ivar enabled: Indicates whether the test endpoint feature enabled or not. + :vartype enabled: bool + """ + + _attribute_map = { + 'primary_key': {'key': 'primaryKey', 'type': 'str'}, + 'secondary_key': {'key': 'secondaryKey', 'type': 'str'}, + 'primary_test_endpoint': {'key': 'primaryTestEndpoint', 'type': 'str'}, + 'secondary_test_endpoint': {'key': 'secondaryTestEndpoint', 'type': 'str'}, + 'enabled': {'key': 'enabled', 'type': 'bool'}, + } + + 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 + ): + """ + :keyword primary_key: Primary key. + :paramtype primary_key: str + :keyword secondary_key: Secondary key. + :paramtype secondary_key: str + :keyword primary_test_endpoint: Primary test endpoint. + :paramtype primary_test_endpoint: str + :keyword secondary_test_endpoint: Secondary test endpoint. + :paramtype secondary_test_endpoint: str + :keyword enabled: Indicates whether the test endpoint feature enabled or not. + :paramtype enabled: bool + """ + super(TestKeys, self).__init__(**kwargs) + self.primary_key = primary_key + self.secondary_key = secondary_key + self.primary_test_endpoint = primary_test_endpoint + self.secondary_test_endpoint = secondary_test_endpoint + self.enabled = enabled + + +class UserSourceInfo(msrest.serialization.Model): + """Source information for a deployment. + + :ivar type: Type of the source uploaded. Possible values include: "Jar", "NetCoreZip", + "Source", "Container". + :vartype type: str or ~azure.mgmt.appplatform.v2021_09_01_preview.models.UserSourceType + :ivar relative_path: Relative path of the storage which stores the source. + :vartype relative_path: str + :ivar version: Version of the source. + :vartype version: str + :ivar 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. + :vartype artifact_selector: str + :ivar custom_container: Custom container payload. + :vartype custom_container: ~azure.mgmt.appplatform.v2021_09_01_preview.models.CustomContainer + """ + + _attribute_map = { + 'type': {'key': 'type', 'type': 'str'}, + '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, + *, + 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 + ): + """ + :keyword type: Type of the source uploaded. Possible values include: "Jar", "NetCoreZip", + "Source", "Container". + :paramtype type: str or ~azure.mgmt.appplatform.v2021_09_01_preview.models.UserSourceType + :keyword relative_path: Relative path of the storage which stores the source. + :paramtype relative_path: str + :keyword version: Version of the source. + :paramtype version: str + :keyword 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. + :paramtype artifact_selector: str + :keyword custom_container: Custom container payload. + :paramtype custom_container: ~azure.mgmt.appplatform.v2021_09_01_preview.models.CustomContainer + """ + 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/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2021_09_01_preview/operations/__init__.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2021_09_01_preview/operations/__init__.py new file mode 100644 index 0000000000000..97c71859bbd5f --- /dev/null +++ b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2021_09_01_preview/operations/__init__.py @@ -0,0 +1,35 @@ +# 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 ._storages_operations import StoragesOperations +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', + 'StoragesOperations', + 'CertificatesOperations', + 'CustomDomainsOperations', + 'DeploymentsOperations', + 'Operations', + 'RuntimeVersionsOperations', + 'SkusOperations', +] diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2021_09_01_preview/operations/_apps_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2021_09_01_preview/operations/_apps_operations.py new file mode 100644 index 0000000000000..f72949367db2b --- /dev/null +++ b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2021_09_01_preview/operations/_apps_operations.py @@ -0,0 +1,965 @@ +# 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. +# -------------------------------------------------------------------------- +import functools +from typing import TYPE_CHECKING +import warnings + +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 HttpResponse +from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.arm_polling import ARMPolling +from msrest import Serializer + +from .. import models as _models +from .._vendor import _convert_request, _format_url_section + +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]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False +# fmt: off + +def build_get_request( + subscription_id, # type: str + resource_group_name, # type: str + service_name, # type: str + app_name, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + sync_status = kwargs.pop('sync_status', None) # type: Optional[str] + + api_version = "2021-09-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), + "appName": _SERIALIZER.url("app_name", app_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + if sync_status is not None: + query_parameters['syncStatus'] = _SERIALIZER.query("sync_status", sync_status, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_create_or_update_request_initial( + subscription_id, # type: str + resource_group_name, # type: str + service_name, # type: str + app_name, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2021-09-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), + "appName": _SERIALIZER.url("app_name", app_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_delete_request_initial( + subscription_id, # type: str + resource_group_name, # type: str + service_name, # type: str + app_name, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + api_version = "2021-09-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), + "appName": _SERIALIZER.url("app_name", app_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="DELETE", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_update_request_initial( + subscription_id, # type: str + resource_group_name, # type: str + service_name, # type: str + app_name, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2021-09-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), + "appName": _SERIALIZER.url("app_name", app_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PATCH", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_list_request( + subscription_id, # type: str + resource_group_name, # type: str + service_name, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + api_version = "2021-09-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_get_resource_upload_url_request( + subscription_id, # type: str + resource_group_name, # type: str + service_name, # type: str + app_name, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + api_version = "2021-09-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/getResourceUploadUrl') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), + "appName": _SERIALIZER.url("app_name", app_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_validate_domain_request( + subscription_id, # type: str + resource_group_name, # type: str + service_name, # type: str + app_name, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2021-09-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/validateDomain') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), + "appName": _SERIALIZER.url("app_name", app_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + +# fmt: on +class AppsOperations(object): + """AppsOperations 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_09_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): + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + @distributed_trace + def get( + 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. + :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_09_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', {})) + + + request = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + sync_status=sync_status, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = 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 + + + def _create_or_update_initial( + 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', {})) + + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(app_resource, 'AppResource') + + request = build_create_or_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = 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 + + + @distributed_trace + 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. + :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_09_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_09_01_preview.models.AppResource] + :raises: ~azure.core.exceptions.HttpResponseError + """ + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + 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 = self._create_or_update_initial( + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + app_resource=app_resource, + content_type=content_type, + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) + + def get_long_running_output(pipeline_response): + response = pipeline_response.http_response + deserialized = self._deserialize('AppResource', pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + 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, # 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', {})) + + + request = build_delete_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = 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 + + + @distributed_trace + 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. + :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 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 + """ + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.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) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) + + + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + 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, # 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', {})) + + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(app_resource, 'AppResource') + + request = build_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + content_type=content_type, + json=_json, + template_url=self._update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = 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 + + + @distributed_trace + 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. + :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_09_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_09_01_preview.models.AppResource] + :raises: ~azure.core.exceptions.HttpResponseError + """ + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + 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 = self._update_initial( + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + app_resource=app_resource, + content_type=content_type, + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) + + def get_long_running_output(pipeline_response): + response = pipeline_response.http_response + deserialized = self._deserialize('AppResource', pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + 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 + + @distributed_trace + def list( + 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. + :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.paging.ItemPaged[~azure.mgmt.appplatform.v2021_09_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', {})) + def prepare_request(next_link=None): + if not next_link: + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + 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) + + pipeline_response = 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 ItemPaged( + get_next, extract_data + ) + list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps'} # type: ignore + + @distributed_trace + def get_resource_upload_url( + 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 + :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_09_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', {})) + + + request = build_get_resource_upload_url_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + template_url=self.get_resource_upload_url.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = 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 + + + @distributed_trace + def validate_domain( + 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. + :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_09_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_09_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', {})) + + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(validate_payload, 'CustomDomainValidatePayload') + + request = build_validate_domain_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + content_type=content_type, + json=_json, + template_url=self.validate_domain.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = 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/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2021_09_01_preview/operations/_bindings_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2021_09_01_preview/operations/_bindings_operations.py new file mode 100644 index 0000000000000..c15741eedfa53 --- /dev/null +++ b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2021_09_01_preview/operations/_bindings_operations.py @@ -0,0 +1,791 @@ +# 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. +# -------------------------------------------------------------------------- +import functools +from typing import TYPE_CHECKING +import warnings + +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 HttpResponse +from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.arm_polling import ARMPolling +from msrest import Serializer + +from .. import models as _models +from .._vendor import _convert_request, _format_url_section + +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]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False +# fmt: off + +def build_get_request( + subscription_id, # type: str + resource_group_name, # type: str + service_name, # type: str + app_name, # type: str + binding_name, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + api_version = "2021-09-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/bindings/{bindingName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), + "appName": _SERIALIZER.url("app_name", app_name, 'str'), + "bindingName": _SERIALIZER.url("binding_name", binding_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_create_or_update_request_initial( + subscription_id, # type: str + resource_group_name, # type: str + service_name, # type: str + app_name, # type: str + binding_name, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2021-09-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/bindings/{bindingName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), + "appName": _SERIALIZER.url("app_name", app_name, 'str'), + "bindingName": _SERIALIZER.url("binding_name", binding_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_delete_request_initial( + subscription_id, # type: str + resource_group_name, # type: str + service_name, # type: str + app_name, # type: str + binding_name, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + api_version = "2021-09-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/bindings/{bindingName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), + "appName": _SERIALIZER.url("app_name", app_name, 'str'), + "bindingName": _SERIALIZER.url("binding_name", binding_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="DELETE", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_update_request_initial( + subscription_id, # type: str + resource_group_name, # type: str + service_name, # type: str + app_name, # type: str + binding_name, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2021-09-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/bindings/{bindingName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), + "appName": _SERIALIZER.url("app_name", app_name, 'str'), + "bindingName": _SERIALIZER.url("binding_name", binding_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PATCH", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_list_request( + subscription_id, # type: str + resource_group_name, # type: str + service_name, # type: str + app_name, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + api_version = "2021-09-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/bindings') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), + "appName": _SERIALIZER.url("app_name", app_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + +# fmt: on +class BindingsOperations(object): + """BindingsOperations 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_09_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): + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + @distributed_trace + def get( + 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. + :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_09_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', {})) + + + request = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + binding_name=binding_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = 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 + + + def _create_or_update_initial( + 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', {})) + + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(binding_resource, 'BindingResource') + + request = build_create_or_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + binding_name=binding_name, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = 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 + + + @distributed_trace + 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. + :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_09_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_09_01_preview.models.BindingResource] + :raises: ~azure.core.exceptions.HttpResponseError + """ + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + 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 = 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, + content_type=content_type, + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) + + def get_long_running_output(pipeline_response): + response = pipeline_response.http_response + deserialized = self._deserialize('BindingResource', pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + 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, # 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', {})) + + + request = build_delete_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + binding_name=binding_name, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = 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 + + + @distributed_trace + 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. + :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 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 + """ + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.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) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) + + + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + 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, # 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', {})) + + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(binding_resource, 'BindingResource') + + request = build_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + binding_name=binding_name, + content_type=content_type, + json=_json, + template_url=self._update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = 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 + + + @distributed_trace + 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. + :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_09_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_09_01_preview.models.BindingResource] + :raises: ~azure.core.exceptions.HttpResponseError + """ + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + 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 = 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, + content_type=content_type, + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) + + def get_long_running_output(pipeline_response): + response = pipeline_response.http_response + deserialized = self._deserialize('BindingResource', pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + 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 + + @distributed_trace + def list( + 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. + :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.paging.ItemPaged[~azure.mgmt.appplatform.v2021_09_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', {})) + def prepare_request(next_link=None): + if not next_link: + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + 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) + + pipeline_response = 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 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/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2021_09_01_preview/operations/_certificates_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2021_09_01_preview/operations/_certificates_operations.py new file mode 100644 index 0000000000000..9e929c9a04de1 --- /dev/null +++ b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2021_09_01_preview/operations/_certificates_operations.py @@ -0,0 +1,583 @@ +# 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. +# -------------------------------------------------------------------------- +import functools +from typing import TYPE_CHECKING +import warnings + +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 HttpResponse +from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.arm_polling import ARMPolling +from msrest import Serializer + +from .. import models as _models +from .._vendor import _convert_request, _format_url_section + +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]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False +# fmt: off + +def build_get_request( + subscription_id, # type: str + resource_group_name, # type: str + service_name, # type: str + certificate_name, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + api_version = "2021-09-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/certificates/{certificateName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), + "certificateName": _SERIALIZER.url("certificate_name", certificate_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_create_or_update_request_initial( + subscription_id, # type: str + resource_group_name, # type: str + service_name, # type: str + certificate_name, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2021-09-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/certificates/{certificateName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), + "certificateName": _SERIALIZER.url("certificate_name", certificate_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_delete_request_initial( + subscription_id, # type: str + resource_group_name, # type: str + service_name, # type: str + certificate_name, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + api_version = "2021-09-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/certificates/{certificateName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), + "certificateName": _SERIALIZER.url("certificate_name", certificate_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="DELETE", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_list_request( + subscription_id, # type: str + resource_group_name, # type: str + service_name, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + api_version = "2021-09-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/certificates') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + +# fmt: on +class CertificatesOperations(object): + """CertificatesOperations 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_09_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): + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + @distributed_trace + def get( + 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. + :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_09_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', {})) + + + request = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + certificate_name=certificate_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = 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 + + + def _create_or_update_initial( + 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', {})) + + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(certificate_resource, 'CertificateResource') + + request = build_create_or_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + certificate_name=certificate_name, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = 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 + + + @distributed_trace + 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. + :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_09_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_09_01_preview.models.CertificateResource] + :raises: ~azure.core.exceptions.HttpResponseError + """ + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + 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 = self._create_or_update_initial( + resource_group_name=resource_group_name, + service_name=service_name, + certificate_name=certificate_name, + certificate_resource=certificate_resource, + content_type=content_type, + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) + + def get_long_running_output(pipeline_response): + response = pipeline_response.http_response + deserialized = self._deserialize('CertificateResource', pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + 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, # 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', {})) + + + request = build_delete_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + certificate_name=certificate_name, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = 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 + + + @distributed_trace + 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. + :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 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 + """ + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.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) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) + + + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + 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 + + @distributed_trace + def list( + 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. + :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.paging.ItemPaged[~azure.mgmt.appplatform.v2021_09_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', {})) + def prepare_request(next_link=None): + if not next_link: + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + 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) + + pipeline_response = 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 ItemPaged( + get_next, extract_data + ) + list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/certificates'} # type: ignore diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2021_09_01_preview/operations/_config_servers_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2021_09_01_preview/operations/_config_servers_operations.py new file mode 100644 index 0000000000000..b97430cbbc262 --- /dev/null +++ b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2021_09_01_preview/operations/_config_servers_operations.py @@ -0,0 +1,639 @@ +# 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. +# -------------------------------------------------------------------------- +import functools +from typing import TYPE_CHECKING +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 HttpResponse +from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.arm_polling import ARMPolling +from msrest import Serializer + +from .. import models as _models +from .._vendor import _convert_request, _format_url_section + +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]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False +# fmt: off + +def build_get_request( + subscription_id, # type: str + resource_group_name, # type: str + service_name, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + api_version = "2021-09-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configServers/default') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_update_put_request_initial( + subscription_id, # type: str + resource_group_name, # type: str + service_name, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2021-09-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configServers/default') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_update_patch_request_initial( + subscription_id, # type: str + resource_group_name, # type: str + service_name, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2021-09-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configServers/default') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PATCH", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_validate_request_initial( + subscription_id, # type: str + resource_group_name, # type: str + service_name, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2021-09-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configServers/validate') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + +# fmt: on +class ConfigServersOperations(object): + """ConfigServersOperations 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_09_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): + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + @distributed_trace + def get( + 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. + :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_09_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', {})) + + + request = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = 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 + + + def _update_put_initial( + 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', {})) + + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(config_server_resource, 'ConfigServerResource') + + request = build_update_put_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + content_type=content_type, + json=_json, + template_url=self._update_put_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = 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 + + + @distributed_trace + 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. + :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_09_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_09_01_preview.models.ConfigServerResource] + :raises: ~azure.core.exceptions.HttpResponseError + """ + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + 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 = self._update_put_initial( + resource_group_name=resource_group_name, + service_name=service_name, + config_server_resource=config_server_resource, + content_type=content_type, + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) + + def get_long_running_output(pipeline_response): + response = pipeline_response.http_response + deserialized = self._deserialize('ConfigServerResource', pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + 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, # 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', {})) + + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(config_server_resource, 'ConfigServerResource') + + request = build_update_patch_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + content_type=content_type, + json=_json, + template_url=self._update_patch_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = 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 + + + @distributed_trace + 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. + :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_09_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_09_01_preview.models.ConfigServerResource] + :raises: ~azure.core.exceptions.HttpResponseError + """ + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + 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 = self._update_patch_initial( + resource_group_name=resource_group_name, + service_name=service_name, + config_server_resource=config_server_resource, + content_type=content_type, + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) + + def get_long_running_output(pipeline_response): + response = pipeline_response.http_response + deserialized = self._deserialize('ConfigServerResource', pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + 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, # 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', {})) + + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(config_server_settings, 'ConfigServerSettings') + + request = build_validate_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + content_type=content_type, + json=_json, + template_url=self._validate_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = 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 + + + @distributed_trace + 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. + :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_09_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_09_01_preview.models.ConfigServerSettingsValidateResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + 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 = self._validate_initial( + resource_group_name=resource_group_name, + service_name=service_name, + config_server_settings=config_server_settings, + content_type=content_type, + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) + + def get_long_running_output(pipeline_response): + response = pipeline_response.http_response + deserialized = self._deserialize('ConfigServerSettingsValidateResult', pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, **kwargs) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + 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/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2021_09_01_preview/operations/_custom_domains_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2021_09_01_preview/operations/_custom_domains_operations.py new file mode 100644 index 0000000000000..945e527217d84 --- /dev/null +++ b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2021_09_01_preview/operations/_custom_domains_operations.py @@ -0,0 +1,791 @@ +# 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. +# -------------------------------------------------------------------------- +import functools +from typing import TYPE_CHECKING +import warnings + +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 HttpResponse +from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.arm_polling import ARMPolling +from msrest import Serializer + +from .. import models as _models +from .._vendor import _convert_request, _format_url_section + +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]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False +# fmt: off + +def build_get_request( + subscription_id, # type: str + resource_group_name, # type: str + service_name, # type: str + app_name, # type: str + domain_name, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + api_version = "2021-09-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/domains/{domainName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), + "appName": _SERIALIZER.url("app_name", app_name, 'str'), + "domainName": _SERIALIZER.url("domain_name", domain_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_create_or_update_request_initial( + subscription_id, # type: str + resource_group_name, # type: str + service_name, # type: str + app_name, # type: str + domain_name, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2021-09-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/domains/{domainName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), + "appName": _SERIALIZER.url("app_name", app_name, 'str'), + "domainName": _SERIALIZER.url("domain_name", domain_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_delete_request_initial( + subscription_id, # type: str + resource_group_name, # type: str + service_name, # type: str + app_name, # type: str + domain_name, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + api_version = "2021-09-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/domains/{domainName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), + "appName": _SERIALIZER.url("app_name", app_name, 'str'), + "domainName": _SERIALIZER.url("domain_name", domain_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="DELETE", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_update_request_initial( + subscription_id, # type: str + resource_group_name, # type: str + service_name, # type: str + app_name, # type: str + domain_name, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2021-09-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/domains/{domainName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), + "appName": _SERIALIZER.url("app_name", app_name, 'str'), + "domainName": _SERIALIZER.url("domain_name", domain_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PATCH", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_list_request( + subscription_id, # type: str + resource_group_name, # type: str + service_name, # type: str + app_name, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + api_version = "2021-09-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/domains') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), + "appName": _SERIALIZER.url("app_name", app_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + +# fmt: on +class CustomDomainsOperations(object): + """CustomDomainsOperations 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_09_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): + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + @distributed_trace + def get( + 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. + :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_09_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', {})) + + + request = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + domain_name=domain_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = 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 + + + def _create_or_update_initial( + 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', {})) + + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(domain_resource, 'CustomDomainResource') + + request = build_create_or_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + domain_name=domain_name, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = 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 + + + @distributed_trace + 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. + :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_09_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_09_01_preview.models.CustomDomainResource] + :raises: ~azure.core.exceptions.HttpResponseError + """ + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + 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 = 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, + content_type=content_type, + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) + + def get_long_running_output(pipeline_response): + response = pipeline_response.http_response + deserialized = self._deserialize('CustomDomainResource', pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + 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, # 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', {})) + + + request = build_delete_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + domain_name=domain_name, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = 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 + + + @distributed_trace + 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. + :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 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 + """ + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.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) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) + + + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + 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, # 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', {})) + + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(domain_resource, 'CustomDomainResource') + + request = build_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + domain_name=domain_name, + content_type=content_type, + json=_json, + template_url=self._update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = 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 + + + @distributed_trace + 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. + :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_09_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_09_01_preview.models.CustomDomainResource] + :raises: ~azure.core.exceptions.HttpResponseError + """ + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + 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 = 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, + content_type=content_type, + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) + + def get_long_running_output(pipeline_response): + response = pipeline_response.http_response + deserialized = self._deserialize('CustomDomainResource', pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + 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 + + @distributed_trace + def list( + 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. + :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.paging.ItemPaged[~azure.mgmt.appplatform.v2021_09_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', {})) + def prepare_request(next_link=None): + if not next_link: + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + 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) + + pipeline_response = 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 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/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2021_09_01_preview/operations/_deployments_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2021_09_01_preview/operations/_deployments_operations.py new file mode 100644 index 0000000000000..f40d0a3c82188 --- /dev/null +++ b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2021_09_01_preview/operations/_deployments_operations.py @@ -0,0 +1,1984 @@ +# 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. +# -------------------------------------------------------------------------- +import functools +from typing import TYPE_CHECKING +import warnings + +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 HttpResponse +from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.arm_polling import ARMPolling +from msrest import Serializer + +from .. import models as _models +from .._vendor import _convert_request, _format_url_section + +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]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False +# fmt: off + +def build_get_request( + subscription_id, # type: str + resource_group_name, # type: str + service_name, # type: str + app_name, # type: str + deployment_name, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + api_version = "2021-09-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), + "appName": _SERIALIZER.url("app_name", app_name, 'str'), + "deploymentName": _SERIALIZER.url("deployment_name", deployment_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_create_or_update_request_initial( + subscription_id, # type: str + resource_group_name, # type: str + service_name, # type: str + app_name, # type: str + deployment_name, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2021-09-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), + "appName": _SERIALIZER.url("app_name", app_name, 'str'), + "deploymentName": _SERIALIZER.url("deployment_name", deployment_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_delete_request_initial( + subscription_id, # type: str + resource_group_name, # type: str + service_name, # type: str + app_name, # type: str + deployment_name, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + api_version = "2021-09-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), + "appName": _SERIALIZER.url("app_name", app_name, 'str'), + "deploymentName": _SERIALIZER.url("deployment_name", deployment_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="DELETE", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_update_request_initial( + subscription_id, # type: str + resource_group_name, # type: str + service_name, # type: str + app_name, # type: str + deployment_name, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2021-09-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), + "appName": _SERIALIZER.url("app_name", app_name, 'str'), + "deploymentName": _SERIALIZER.url("deployment_name", deployment_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PATCH", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_list_request( + subscription_id, # type: str + resource_group_name, # type: str + service_name, # type: str + app_name, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + version = kwargs.pop('version', None) # type: Optional[List[str]] + + api_version = "2021-09-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), + "appName": _SERIALIZER.url("app_name", app_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + if version is not None: + query_parameters['version'] = [_SERIALIZER.query("version", q, 'str') if q is not None else '' for q in version] + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_list_for_cluster_request( + subscription_id, # type: str + resource_group_name, # type: str + service_name, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + version = kwargs.pop('version', None) # type: Optional[List[str]] + + api_version = "2021-09-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/deployments') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + if version is not None: + query_parameters['version'] = [_SERIALIZER.query("version", q, 'str') if q is not None else '' for q in version] + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_start_request_initial( + subscription_id, # type: str + resource_group_name, # type: str + service_name, # type: str + app_name, # type: str + deployment_name, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + api_version = "2021-09-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/start') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), + "appName": _SERIALIZER.url("app_name", app_name, 'str'), + "deploymentName": _SERIALIZER.url("deployment_name", deployment_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_stop_request_initial( + subscription_id, # type: str + resource_group_name, # type: str + service_name, # type: str + app_name, # type: str + deployment_name, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + api_version = "2021-09-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/stop') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), + "appName": _SERIALIZER.url("app_name", app_name, 'str'), + "deploymentName": _SERIALIZER.url("deployment_name", deployment_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_restart_request_initial( + subscription_id, # type: str + resource_group_name, # type: str + service_name, # type: str + app_name, # type: str + deployment_name, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + api_version = "2021-09-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/restart') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), + "appName": _SERIALIZER.url("app_name", app_name, 'str'), + "deploymentName": _SERIALIZER.url("deployment_name", deployment_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_get_log_file_url_request( + subscription_id, # type: str + resource_group_name, # type: str + service_name, # type: str + app_name, # type: str + deployment_name, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + api_version = "2021-09-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/getLogFileUrl') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), + "appName": _SERIALIZER.url("app_name", app_name, 'str'), + "deploymentName": _SERIALIZER.url("deployment_name", deployment_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_generate_heap_dump_request_initial( + subscription_id, # type: str + resource_group_name, # type: str + service_name, # type: str + app_name, # type: str + deployment_name, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2021-09-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/generateHeapDump') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), + "appName": _SERIALIZER.url("app_name", app_name, 'str'), + "deploymentName": _SERIALIZER.url("deployment_name", deployment_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_generate_thread_dump_request_initial( + subscription_id, # type: str + resource_group_name, # type: str + service_name, # type: str + app_name, # type: str + deployment_name, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2021-09-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/generateThreadDump') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), + "appName": _SERIALIZER.url("app_name", app_name, 'str'), + "deploymentName": _SERIALIZER.url("deployment_name", deployment_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_start_jfr_request_initial( + subscription_id, # type: str + resource_group_name, # type: str + service_name, # type: str + app_name, # type: str + deployment_name, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2021-09-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/StartJFR') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), + "appName": _SERIALIZER.url("app_name", app_name, 'str'), + "deploymentName": _SERIALIZER.url("deployment_name", deployment_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + +# fmt: on +class DeploymentsOperations(object): + """DeploymentsOperations 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_09_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): + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + @distributed_trace + def get( + 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. + :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_09_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', {})) + + + request = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + deployment_name=deployment_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = 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 + + + def _create_or_update_initial( + 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', {})) + + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(deployment_resource, 'DeploymentResource') + + request = build_create_or_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + deployment_name=deployment_name, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = 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 + + + @distributed_trace + 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. + :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_09_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_09_01_preview.models.DeploymentResource] + :raises: ~azure.core.exceptions.HttpResponseError + """ + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + 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 = 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, + content_type=content_type, + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) + + def get_long_running_output(pipeline_response): + response = pipeline_response.http_response + deserialized = self._deserialize('DeploymentResource', pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + 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, # 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', {})) + + + request = build_delete_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + deployment_name=deployment_name, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = 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 + + + @distributed_trace + 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. + :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 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 + """ + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.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) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) + + + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + 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, # 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', {})) + + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(deployment_resource, 'DeploymentResource') + + request = build_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + deployment_name=deployment_name, + content_type=content_type, + json=_json, + template_url=self._update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = 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 + + + @distributed_trace + 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. + :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_09_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_09_01_preview.models.DeploymentResource] + :raises: ~azure.core.exceptions.HttpResponseError + """ + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + 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 = 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, + content_type=content_type, + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) + + def get_long_running_output(pipeline_response): + response = pipeline_response.http_response + deserialized = self._deserialize('DeploymentResource', pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + 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 + + @distributed_trace + def list( + 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. + :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.paging.ItemPaged[~azure.mgmt.appplatform.v2021_09_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', {})) + def prepare_request(next_link=None): + if not next_link: + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + version=version, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + version=version, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + 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) + + pipeline_response = 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 ItemPaged( + get_next, extract_data + ) + list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments'} # type: ignore + + @distributed_trace + def list_for_cluster( + 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. + :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.paging.ItemPaged[~azure.mgmt.appplatform.v2021_09_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', {})) + def prepare_request(next_link=None): + if not next_link: + + request = build_list_for_cluster_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + version=version, + template_url=self.list_for_cluster.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + + request = build_list_for_cluster_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + version=version, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + 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) + + pipeline_response = 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 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, # 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', {})) + + + request = build_start_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + deployment_name=deployment_name, + template_url=self._start_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = 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 + + + @distributed_trace + 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. + :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 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 + """ + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.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) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) + + + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + 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, # 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', {})) + + + request = build_stop_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + deployment_name=deployment_name, + template_url=self._stop_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = 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 + + + @distributed_trace + 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. + :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 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 + """ + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.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) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) + + + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + 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, # 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', {})) + + + request = build_restart_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + deployment_name=deployment_name, + template_url=self._restart_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = 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 + + + @distributed_trace + 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. + :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 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 + """ + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.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) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) + + + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + 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 + + @distributed_trace + def get_log_file_url( + 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. + :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_09_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', {})) + + + request = build_get_log_file_url_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + deployment_name=deployment_name, + template_url=self.get_log_file_url.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = 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 + + + def _generate_heap_dump_initial( + self, + resource_group_name, # type: str + service_name, # type: str + app_name, # type: str + deployment_name, # type: str + diagnostic_parameters, # type: "_models.DiagnosticParameters" + **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', {})) + + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(diagnostic_parameters, 'DiagnosticParameters') + + request = build_generate_heap_dump_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + deployment_name=deployment_name, + content_type=content_type, + json=_json, + template_url=self._generate_heap_dump_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = 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, {}) + + _generate_heap_dump_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/generateHeapDump'} # type: ignore + + + @distributed_trace + def begin_generate_heap_dump( + self, + resource_group_name, # type: str + service_name, # type: str + app_name, # type: str + deployment_name, # type: str + diagnostic_parameters, # type: "_models.DiagnosticParameters" + **kwargs # type: Any + ): + # type: (...) -> LROPoller[None] + """Generate Heap Dump. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure 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 diagnostic_parameters: Parameters for the diagnostic operation. + :type diagnostic_parameters: + ~azure.mgmt.appplatform.v2021_09_01_preview.models.DiagnosticParameters + :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 + """ + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.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._generate_heap_dump_initial( + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + deployment_name=deployment_name, + diagnostic_parameters=diagnostic_parameters, + content_type=content_type, + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) + + + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + 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_generate_heap_dump.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/generateHeapDump'} # type: ignore + + def _generate_thread_dump_initial( + self, + resource_group_name, # type: str + service_name, # type: str + app_name, # type: str + deployment_name, # type: str + diagnostic_parameters, # type: "_models.DiagnosticParameters" + **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', {})) + + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(diagnostic_parameters, 'DiagnosticParameters') + + request = build_generate_thread_dump_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + deployment_name=deployment_name, + content_type=content_type, + json=_json, + template_url=self._generate_thread_dump_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = 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, {}) + + _generate_thread_dump_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/generateThreadDump'} # type: ignore + + + @distributed_trace + def begin_generate_thread_dump( + self, + resource_group_name, # type: str + service_name, # type: str + app_name, # type: str + deployment_name, # type: str + diagnostic_parameters, # type: "_models.DiagnosticParameters" + **kwargs # type: Any + ): + # type: (...) -> LROPoller[None] + """Generate Thread Dump. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure 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 diagnostic_parameters: Parameters for the diagnostic operation. + :type diagnostic_parameters: + ~azure.mgmt.appplatform.v2021_09_01_preview.models.DiagnosticParameters + :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 + """ + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.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._generate_thread_dump_initial( + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + deployment_name=deployment_name, + diagnostic_parameters=diagnostic_parameters, + content_type=content_type, + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) + + + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + 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_generate_thread_dump.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/generateThreadDump'} # type: ignore + + def _start_jfr_initial( + self, + resource_group_name, # type: str + service_name, # type: str + app_name, # type: str + deployment_name, # type: str + diagnostic_parameters, # type: "_models.DiagnosticParameters" + **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', {})) + + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(diagnostic_parameters, 'DiagnosticParameters') + + request = build_start_jfr_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + deployment_name=deployment_name, + content_type=content_type, + json=_json, + template_url=self._start_jfr_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = 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_jfr_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/StartJFR'} # type: ignore + + + @distributed_trace + def begin_start_jfr( + self, + resource_group_name, # type: str + service_name, # type: str + app_name, # type: str + deployment_name, # type: str + diagnostic_parameters, # type: "_models.DiagnosticParameters" + **kwargs # type: Any + ): + # type: (...) -> LROPoller[None] + """Start JFR. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure 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 diagnostic_parameters: Parameters for the diagnostic operation. + :type diagnostic_parameters: + ~azure.mgmt.appplatform.v2021_09_01_preview.models.DiagnosticParameters + :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 + """ + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.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_jfr_initial( + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + deployment_name=deployment_name, + diagnostic_parameters=diagnostic_parameters, + content_type=content_type, + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) + + + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + 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_jfr.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/StartJFR'} # type: ignore diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2021_09_01_preview/operations/_monitoring_settings_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2021_09_01_preview/operations/_monitoring_settings_operations.py new file mode 100644 index 0000000000000..fa69ffbc43a9f --- /dev/null +++ b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2021_09_01_preview/operations/_monitoring_settings_operations.py @@ -0,0 +1,474 @@ +# 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. +# -------------------------------------------------------------------------- +import functools +from typing import TYPE_CHECKING +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 HttpResponse +from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.arm_polling import ARMPolling +from msrest import Serializer + +from .. import models as _models +from .._vendor import _convert_request, _format_url_section + +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]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False +# fmt: off + +def build_get_request( + subscription_id, # type: str + resource_group_name, # type: str + service_name, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + api_version = "2021-09-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/monitoringSettings/default') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_update_put_request_initial( + subscription_id, # type: str + resource_group_name, # type: str + service_name, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2021-09-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/monitoringSettings/default') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_update_patch_request_initial( + subscription_id, # type: str + resource_group_name, # type: str + service_name, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2021-09-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/monitoringSettings/default') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PATCH", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + +# fmt: on +class MonitoringSettingsOperations(object): + """MonitoringSettingsOperations 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_09_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): + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + @distributed_trace + def get( + 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. + :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_09_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', {})) + + + request = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = 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 + + + def _update_put_initial( + 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', {})) + + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(monitoring_setting_resource, 'MonitoringSettingResource') + + request = build_update_put_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + content_type=content_type, + json=_json, + template_url=self._update_put_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = 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 + + + @distributed_trace + 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. + :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_09_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_09_01_preview.models.MonitoringSettingResource] + :raises: ~azure.core.exceptions.HttpResponseError + """ + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + 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 = self._update_put_initial( + resource_group_name=resource_group_name, + service_name=service_name, + monitoring_setting_resource=monitoring_setting_resource, + content_type=content_type, + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) + + def get_long_running_output(pipeline_response): + response = pipeline_response.http_response + deserialized = self._deserialize('MonitoringSettingResource', pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + 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, # 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', {})) + + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(monitoring_setting_resource, 'MonitoringSettingResource') + + request = build_update_patch_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + content_type=content_type, + json=_json, + template_url=self._update_patch_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = 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 + + + @distributed_trace + 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. + :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_09_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_09_01_preview.models.MonitoringSettingResource] + :raises: ~azure.core.exceptions.HttpResponseError + """ + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + 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 = self._update_patch_initial( + resource_group_name=resource_group_name, + service_name=service_name, + monitoring_setting_resource=monitoring_setting_resource, + content_type=content_type, + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) + + def get_long_running_output(pipeline_response): + response = pipeline_response.http_response + deserialized = self._deserialize('MonitoringSettingResource', pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + 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/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2021_09_01_preview/operations/_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2021_09_01_preview/operations/_operations.py new file mode 100644 index 0000000000000..99825d1f52cfa --- /dev/null +++ b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2021_09_01_preview/operations/_operations.py @@ -0,0 +1,143 @@ +# 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. +# -------------------------------------------------------------------------- +import functools +from typing import TYPE_CHECKING +import warnings + +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 HttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.mgmt.core.exceptions import ARMErrorFormat +from msrest import Serializer + +from .. import models as _models +from .._vendor import _convert_request + +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]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False +# fmt: off + +def build_list_request( + **kwargs # type: Any +): + # type: (...) -> HttpRequest + api_version = "2021-09-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/providers/Microsoft.AppPlatform/operations') + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + +# fmt: on +class Operations(object): + """Operations 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_09_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): + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + @distributed_trace + def list( + 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_09_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', {})) + def prepare_request(next_link=None): + if not next_link: + + request = build_list_request( + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + + request = build_list_request( + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + 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) + + pipeline_response = 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 ItemPaged( + get_next, extract_data + ) + list.metadata = {'url': '/providers/Microsoft.AppPlatform/operations'} # type: ignore diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2021_09_01_preview/operations/_runtime_versions_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2021_09_01_preview/operations/_runtime_versions_operations.py new file mode 100644 index 0000000000000..b5c7a03cbf375 --- /dev/null +++ b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2021_09_01_preview/operations/_runtime_versions_operations.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. +# -------------------------------------------------------------------------- +import functools +from typing import TYPE_CHECKING +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 HttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.mgmt.core.exceptions import ARMErrorFormat +from msrest import Serializer + +from .. import models as _models +from .._vendor import _convert_request + +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]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False +# fmt: off + +def build_list_runtime_versions_request( + **kwargs # type: Any +): + # type: (...) -> HttpRequest + api_version = "2021-09-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/providers/Microsoft.AppPlatform/runtimeVersions') + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + +# fmt: on +class RuntimeVersionsOperations(object): + """RuntimeVersionsOperations 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_09_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): + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + @distributed_trace + def list_runtime_versions( + 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_09_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', {})) + + + request = build_list_runtime_versions_request( + template_url=self.list_runtime_versions.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = 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/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2021_09_01_preview/operations/_services_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2021_09_01_preview/operations/_services_operations.py new file mode 100644 index 0000000000000..2a565da217dcc --- /dev/null +++ b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2021_09_01_preview/operations/_services_operations.py @@ -0,0 +1,1543 @@ +# 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. +# -------------------------------------------------------------------------- +import functools +from typing import TYPE_CHECKING +import warnings + +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 HttpResponse +from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.arm_polling import ARMPolling +from msrest import Serializer + +from .. import models as _models +from .._vendor import _convert_request, _format_url_section + +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]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False +# fmt: off + +def build_get_request( + subscription_id, # type: str + resource_group_name, # type: str + service_name, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + api_version = "2021-09-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_create_or_update_request_initial( + subscription_id, # type: str + resource_group_name, # type: str + service_name, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2021-09-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_delete_request_initial( + subscription_id, # type: str + resource_group_name, # type: str + service_name, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + api_version = "2021-09-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="DELETE", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_update_request_initial( + subscription_id, # type: str + resource_group_name, # type: str + service_name, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2021-09-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PATCH", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_list_test_keys_request( + subscription_id, # type: str + resource_group_name, # type: str + service_name, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + api_version = "2021-09-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/listTestKeys') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_regenerate_test_key_request( + subscription_id, # type: str + resource_group_name, # type: str + service_name, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2021-09-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/regenerateTestKey') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_disable_test_endpoint_request( + subscription_id, # type: str + resource_group_name, # type: str + service_name, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + api_version = "2021-09-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/disableTestEndpoint') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_enable_test_endpoint_request( + subscription_id, # type: str + resource_group_name, # type: str + service_name, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + api_version = "2021-09-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/enableTestEndpoint') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_stop_request_initial( + subscription_id, # type: str + resource_group_name, # type: str + service_name, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + api_version = "2021-09-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/stop') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_start_request_initial( + subscription_id, # type: str + resource_group_name, # type: str + service_name, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + api_version = "2021-09-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/start') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_check_name_availability_request( + subscription_id, # type: str + location, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2021-09-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.AppPlatform/locations/{location}/checkNameAvailability') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "location": _SERIALIZER.url("location", location, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_list_by_subscription_request( + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + api_version = "2021-09-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.AppPlatform/Spring') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_list_request( + subscription_id, # type: str + resource_group_name, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + api_version = "2021-09-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + +# fmt: on +class ServicesOperations(object): + """ServicesOperations 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_09_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): + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + @distributed_trace + def get( + 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. + :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_09_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', {})) + + + request = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = 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 + + + def _create_or_update_initial( + 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', {})) + + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(resource, 'ServiceResource') + + request = build_create_or_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = 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 + + + @distributed_trace + 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. + :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_09_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_09_01_preview.models.ServiceResource] + :raises: ~azure.core.exceptions.HttpResponseError + """ + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + 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 = self._create_or_update_initial( + resource_group_name=resource_group_name, + service_name=service_name, + resource=resource, + content_type=content_type, + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) + + def get_long_running_output(pipeline_response): + response = pipeline_response.http_response + deserialized = self._deserialize('ServiceResource', pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + 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, # 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', {})) + + + request = build_delete_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = 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 + + + @distributed_trace + 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. + :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 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 + """ + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.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) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) + + + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + 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, # 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', {})) + + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(resource, 'ServiceResource') + + request = build_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + content_type=content_type, + json=_json, + template_url=self._update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = 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 + + + @distributed_trace + 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. + :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_09_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_09_01_preview.models.ServiceResource] + :raises: ~azure.core.exceptions.HttpResponseError + """ + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + 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 = self._update_initial( + resource_group_name=resource_group_name, + service_name=service_name, + resource=resource, + content_type=content_type, + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) + + def get_long_running_output(pipeline_response): + response = pipeline_response.http_response + deserialized = self._deserialize('ServiceResource', pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + 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 + + @distributed_trace + def list_test_keys( + 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. + :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_09_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', {})) + + + request = build_list_test_keys_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + template_url=self.list_test_keys.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = 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 + + + @distributed_trace + def regenerate_test_key( + 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. + :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_09_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_09_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', {})) + + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(regenerate_test_key_request, 'RegenerateTestKeyRequestPayload') + + request = build_regenerate_test_key_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + content_type=content_type, + json=_json, + template_url=self.regenerate_test_key.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = 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 + + + @distributed_trace + def disable_test_endpoint( + 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. + :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', {})) + + + request = build_disable_test_endpoint_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + template_url=self.disable_test_endpoint.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = 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 + + + @distributed_trace + def enable_test_endpoint( + 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. + :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_09_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', {})) + + + request = build_enable_test_endpoint_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + template_url=self.enable_test_endpoint.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = 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 + + + def _stop_initial( + 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', {})) + + + request = build_stop_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + template_url=self._stop_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [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}/stop'} # type: ignore + + + @distributed_trace + def begin_stop( + self, + resource_group_name, # type: str + service_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> LROPoller[None] + """Stop 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 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 + """ + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.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, + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) + + + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + 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}/stop'} # type: ignore + + def _start_initial( + 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', {})) + + + request = build_start_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + template_url=self._start_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [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}/start'} # type: ignore + + + @distributed_trace + def begin_start( + self, + resource_group_name, # type: str + service_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> LROPoller[None] + """Start 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 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 + """ + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.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, + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) + + + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + 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}/start'} # type: ignore + + @distributed_trace + def check_name_availability( + 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. + :type location: str + :param availability_parameters: Parameters supplied to the operation. + :type availability_parameters: + ~azure.mgmt.appplatform.v2021_09_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_09_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', {})) + + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(availability_parameters, 'NameAvailabilityParameters') + + request = build_check_name_availability_request( + subscription_id=self._config.subscription_id, + location=location, + content_type=content_type, + json=_json, + template_url=self.check_name_availability.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = 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 + + + @distributed_trace + def list_by_subscription( + self, + **kwargs # type: Any + ): + # type: (...) -> Iterable["_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.paging.ItemPaged[~azure.mgmt.appplatform.v2021_09_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', {})) + def prepare_request(next_link=None): + if not next_link: + + request = build_list_by_subscription_request( + subscription_id=self._config.subscription_id, + template_url=self.list_by_subscription.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + + request = build_list_by_subscription_request( + subscription_id=self._config.subscription_id, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + 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) + + pipeline_response = 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 ItemPaged( + get_next, extract_data + ) + list_by_subscription.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.AppPlatform/Spring'} # type: ignore + + @distributed_trace + def list( + 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. + :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.paging.ItemPaged[~azure.mgmt.appplatform.v2021_09_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', {})) + def prepare_request(next_link=None): + if not next_link: + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + 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) + + pipeline_response = 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 ItemPaged( + get_next, extract_data + ) + list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring'} # type: ignore diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2021_09_01_preview/operations/_skus_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2021_09_01_preview/operations/_skus_operations.py new file mode 100644 index 0000000000000..e93aa1b1aa6ae --- /dev/null +++ b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2021_09_01_preview/operations/_skus_operations.py @@ -0,0 +1,152 @@ +# 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. +# -------------------------------------------------------------------------- +import functools +from typing import TYPE_CHECKING +import warnings + +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 HttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.mgmt.core.exceptions import ARMErrorFormat +from msrest import Serializer + +from .. import models as _models +from .._vendor import _convert_request, _format_url_section + +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]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False +# fmt: off + +def build_list_request( + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + api_version = "2021-09-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.AppPlatform/skus') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + +# fmt: on +class SkusOperations(object): + """SkusOperations 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_09_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): + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + @distributed_trace + def list( + self, + **kwargs # type: Any + ): + # type: (...) -> Iterable["_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.paging.ItemPaged[~azure.mgmt.appplatform.v2021_09_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', {})) + def prepare_request(next_link=None): + if not next_link: + + request = build_list_request( + subscription_id=self._config.subscription_id, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + + request = build_list_request( + subscription_id=self._config.subscription_id, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + 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) + + pipeline_response = 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 ItemPaged( + get_next, extract_data + ) + list.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.AppPlatform/skus'} # type: ignore diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2021_09_01_preview/operations/_storages_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2021_09_01_preview/operations/_storages_operations.py new file mode 100644 index 0000000000000..3f95509398bae --- /dev/null +++ b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2021_09_01_preview/operations/_storages_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. +# -------------------------------------------------------------------------- +import functools +from typing import TYPE_CHECKING +import warnings + +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 HttpResponse +from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.arm_polling import ARMPolling +from msrest import Serializer + +from .. import models as _models +from .._vendor import _convert_request, _format_url_section + +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]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False +# fmt: off + +def build_get_request( + subscription_id, # type: str + resource_group_name, # type: str + service_name, # type: str + storage_name, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + api_version = "2021-09-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/storages/{storageName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), + "storageName": _SERIALIZER.url("storage_name", storage_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_create_or_update_request_initial( + subscription_id, # type: str + resource_group_name, # type: str + service_name, # type: str + storage_name, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2021-09-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/storages/{storageName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), + "storageName": _SERIALIZER.url("storage_name", storage_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_delete_request_initial( + subscription_id, # type: str + resource_group_name, # type: str + service_name, # type: str + storage_name, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + api_version = "2021-09-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/storages/{storageName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), + "storageName": _SERIALIZER.url("storage_name", storage_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="DELETE", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_list_request( + subscription_id, # type: str + resource_group_name, # type: str + service_name, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + api_version = "2021-09-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/storages') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + +# fmt: on +class StoragesOperations(object): + """StoragesOperations 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_09_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): + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + @distributed_trace + def get( + self, + resource_group_name, # type: str + service_name, # type: str + storage_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> "_models.StorageResource" + """Get the storage 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 storage_name: The name of the storage resource. + :type storage_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: StorageResource, or the result of cls(response) + :rtype: ~azure.mgmt.appplatform.v2021_09_01_preview.models.StorageResource + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.StorageResource"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + storage_name=storage_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = 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('StorageResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/storages/{storageName}'} # type: ignore + + + def _create_or_update_initial( + self, + resource_group_name, # type: str + service_name, # type: str + storage_name, # type: str + storage_resource, # type: "_models.StorageResource" + **kwargs # type: Any + ): + # type: (...) -> "_models.StorageResource" + cls = kwargs.pop('cls', None) # type: ClsType["_models.StorageResource"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(storage_resource, 'StorageResource') + + request = build_create_or_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + storage_name=storage_name, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = 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('StorageResource', pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize('StorageResource', pipeline_response) + + if response.status_code == 202: + deserialized = self._deserialize('StorageResource', 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}/storages/{storageName}'} # type: ignore + + + @distributed_trace + def begin_create_or_update( + self, + resource_group_name, # type: str + service_name, # type: str + storage_name, # type: str + storage_resource, # type: "_models.StorageResource" + **kwargs # type: Any + ): + # type: (...) -> LROPoller["_models.StorageResource"] + """Create or update storage 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 storage_name: The name of the storage resource. + :type storage_name: str + :param storage_resource: Parameters for the create or update operation. + :type storage_resource: ~azure.mgmt.appplatform.v2021_09_01_preview.models.StorageResource + :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 StorageResource or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2021_09_01_preview.models.StorageResource] + :raises: ~azure.core.exceptions.HttpResponseError + """ + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.StorageResource"] + 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._create_or_update_initial( + resource_group_name=resource_group_name, + service_name=service_name, + storage_name=storage_name, + storage_resource=storage_resource, + content_type=content_type, + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) + + def get_long_running_output(pipeline_response): + response = pipeline_response.http_response + deserialized = self._deserialize('StorageResource', pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + 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}/storages/{storageName}'} # type: ignore + + def _delete_initial( + self, + resource_group_name, # type: str + service_name, # type: str + storage_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', {})) + + + request = build_delete_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + storage_name=storage_name, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = 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}/storages/{storageName}'} # type: ignore + + + @distributed_trace + def begin_delete( + self, + resource_group_name, # type: str + service_name, # type: str + storage_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> LROPoller[None] + """Delete the storage 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 storage_name: The name of the storage resource. + :type storage_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 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 + """ + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.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, + storage_name=storage_name, + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) + + + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + 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}/storages/{storageName}'} # type: ignore + + @distributed_trace + def list( + self, + resource_group_name, # type: str + service_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> Iterable["_models.StorageResourceCollection"] + """List all the storages of one Azure Spring Cloud instance. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure 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 StorageResourceCollection or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2021_09_01_preview.models.StorageResourceCollection] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.StorageResourceCollection"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + def prepare_request(next_link=None): + if not next_link: + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize("StorageResourceCollection", 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) + + pipeline_response = 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 ItemPaged( + get_next, extract_data + ) + list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/storages'} # type: ignore diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2021_09_01_preview/py.typed b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2021_09_01_preview/py.typed new file mode 100644 index 0000000000000..e5aff4f83af86 --- /dev/null +++ b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2021_09_01_preview/py.typed @@ -0,0 +1 @@ +# Marker file for PEP 561. \ No newline at end of file