diff --git a/sdk/appplatform/azure-mgmt-appplatform/_meta.json b/sdk/appplatform/azure-mgmt-appplatform/_meta.json index e087fa371e6d..aa8cfb499290 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": "01ba3f78ae2eec1578b1b790a6b3b3e5f9d5123a", "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 --python3-only --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 b417f26cc70d..dde5b97ddd1b 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,8 @@ 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` + * 2022-01-01-preview: :mod:`v2022_01_01_preview.models` """ if api_version == '2019-05-01-preview': from .v2019_05_01_preview import models @@ -109,8 +108,40 @@ 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 + elif api_version == '2022-01-01-preview': + from .v2022_01_01_preview import models + return models raise ValueError("API version {} is not available".format(api_version)) + @property + def api_portal_custom_domains(self): + """Instance depends on the API version: + + * 2022-01-01-preview: :class:`ApiPortalCustomDomainsOperations` + """ + api_version = self._get_api_version('api_portal_custom_domains') + if api_version == '2022-01-01-preview': + from .v2022_01_01_preview.operations import ApiPortalCustomDomainsOperations as OperationClass + else: + raise ValueError("API version {} does not have operation group 'api_portal_custom_domains'".format(api_version)) + return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) + + @property + def api_portals(self): + """Instance depends on the API version: + + * 2022-01-01-preview: :class:`ApiPortalsOperations` + """ + api_version = self._get_api_version('api_portals') + if api_version == '2022-01-01-preview': + from .v2022_01_01_preview.operations import ApiPortalsOperations as OperationClass + else: + raise ValueError("API version {} does not have operation group 'api_portals'".format(api_version)) + return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) + @property def apps(self): """Instance depends on the API version: @@ -119,6 +150,8 @@ 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` + * 2022-01-01-preview: :class:`AppsOperations` """ api_version = self._get_api_version('apps') if api_version == '2019-05-01-preview': @@ -129,6 +162,10 @@ 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 + elif api_version == '2022-01-01-preview': + from .v2022_01_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 +178,8 @@ 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` + * 2022-01-01-preview: :class:`BindingsOperations` """ api_version = self._get_api_version('bindings') if api_version == '2019-05-01-preview': @@ -151,10 +190,66 @@ 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 + elif api_version == '2022-01-01-preview': + from .v2022_01_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))) + @property + def build_service(self): + """Instance depends on the API version: + + * 2022-01-01-preview: :class:`BuildServiceOperations` + """ + api_version = self._get_api_version('build_service') + if api_version == '2022-01-01-preview': + from .v2022_01_01_preview.operations import BuildServiceOperations as OperationClass + else: + raise ValueError("API version {} does not have operation group 'build_service'".format(api_version)) + return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) + + @property + def build_service_agent_pool(self): + """Instance depends on the API version: + + * 2022-01-01-preview: :class:`BuildServiceAgentPoolOperations` + """ + api_version = self._get_api_version('build_service_agent_pool') + if api_version == '2022-01-01-preview': + from .v2022_01_01_preview.operations import BuildServiceAgentPoolOperations as OperationClass + else: + raise ValueError("API version {} does not have operation group 'build_service_agent_pool'".format(api_version)) + return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) + + @property + def build_service_builder(self): + """Instance depends on the API version: + + * 2022-01-01-preview: :class:`BuildServiceBuilderOperations` + """ + api_version = self._get_api_version('build_service_builder') + if api_version == '2022-01-01-preview': + from .v2022_01_01_preview.operations import BuildServiceBuilderOperations as OperationClass + else: + raise ValueError("API version {} does not have operation group 'build_service_builder'".format(api_version)) + return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) + + @property + def buildpack_binding(self): + """Instance depends on the API version: + + * 2022-01-01-preview: :class:`BuildpackBindingOperations` + """ + api_version = self._get_api_version('buildpack_binding') + if api_version == '2022-01-01-preview': + from .v2022_01_01_preview.operations import BuildpackBindingOperations as OperationClass + else: + raise ValueError("API version {} does not have operation group 'buildpack_binding'".format(api_version)) + return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) + @property def certificates(self): """Instance depends on the API version: @@ -163,6 +258,8 @@ 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` + * 2022-01-01-preview: :class:`CertificatesOperations` """ api_version = self._get_api_version('certificates') if api_version == '2019-05-01-preview': @@ -173,6 +270,10 @@ 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 + elif api_version == '2022-01-01-preview': + from .v2022_01_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 +285,8 @@ 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` + * 2022-01-01-preview: :class:`ConfigServersOperations` """ api_version = self._get_api_version('config_servers') if api_version == '2020-07-01': @@ -192,10 +295,27 @@ 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 + elif api_version == '2022-01-01-preview': + from .v2022_01_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))) + @property + def configuration_services(self): + """Instance depends on the API version: + + * 2022-01-01-preview: :class:`ConfigurationServicesOperations` + """ + api_version = self._get_api_version('configuration_services') + if api_version == '2022-01-01-preview': + from .v2022_01_01_preview.operations import ConfigurationServicesOperations as OperationClass + else: + raise ValueError("API version {} does not have operation group 'configuration_services'".format(api_version)) + return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) + @property def custom_domains(self): """Instance depends on the API version: @@ -204,6 +324,8 @@ 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` + * 2022-01-01-preview: :class:`CustomDomainsOperations` """ api_version = self._get_api_version('custom_domains') if api_version == '2019-05-01-preview': @@ -214,6 +336,10 @@ 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 + elif api_version == '2022-01-01-preview': + from .v2022_01_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 +352,8 @@ 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` + * 2022-01-01-preview: :class:`DeploymentsOperations` """ api_version = self._get_api_version('deployments') if api_version == '2019-05-01-preview': @@ -236,10 +364,53 @@ 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 + elif api_version == '2022-01-01-preview': + from .v2022_01_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))) + @property + def gateway_custom_domains(self): + """Instance depends on the API version: + + * 2022-01-01-preview: :class:`GatewayCustomDomainsOperations` + """ + api_version = self._get_api_version('gateway_custom_domains') + if api_version == '2022-01-01-preview': + from .v2022_01_01_preview.operations import GatewayCustomDomainsOperations as OperationClass + else: + raise ValueError("API version {} does not have operation group 'gateway_custom_domains'".format(api_version)) + return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) + + @property + def gateway_route_configs(self): + """Instance depends on the API version: + + * 2022-01-01-preview: :class:`GatewayRouteConfigsOperations` + """ + api_version = self._get_api_version('gateway_route_configs') + if api_version == '2022-01-01-preview': + from .v2022_01_01_preview.operations import GatewayRouteConfigsOperations as OperationClass + else: + raise ValueError("API version {} does not have operation group 'gateway_route_configs'".format(api_version)) + return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) + + @property + def gateways(self): + """Instance depends on the API version: + + * 2022-01-01-preview: :class:`GatewaysOperations` + """ + api_version = self._get_api_version('gateways') + if api_version == '2022-01-01-preview': + from .v2022_01_01_preview.operations import GatewaysOperations as OperationClass + else: + raise ValueError("API version {} does not have operation group 'gateways'".format(api_version)) + return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) + @property def monitoring_settings(self): """Instance depends on the API version: @@ -247,6 +418,8 @@ 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` + * 2022-01-01-preview: :class:`MonitoringSettingsOperations` """ api_version = self._get_api_version('monitoring_settings') if api_version == '2020-07-01': @@ -255,6 +428,10 @@ 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 + elif api_version == '2022-01-01-preview': + from .v2022_01_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 +444,8 @@ 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` + * 2022-01-01-preview: :class:`Operations` """ api_version = self._get_api_version('operations') if api_version == '2019-05-01-preview': @@ -277,6 +456,10 @@ 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 + elif api_version == '2022-01-01-preview': + from .v2022_01_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 +472,8 @@ 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` + * 2022-01-01-preview: :class:`RuntimeVersionsOperations` """ api_version = self._get_api_version('runtime_versions') if api_version == '2019-05-01-preview': @@ -299,10 +484,27 @@ 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 + elif api_version == '2022-01-01-preview': + from .v2022_01_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))) + @property + def service_registries(self): + """Instance depends on the API version: + + * 2022-01-01-preview: :class:`ServiceRegistriesOperations` + """ + api_version = self._get_api_version('service_registries') + if api_version == '2022-01-01-preview': + from .v2022_01_01_preview.operations import ServiceRegistriesOperations as OperationClass + else: + raise ValueError("API version {} does not have operation group 'service_registries'".format(api_version)) + return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) + @property def services(self): """Instance depends on the API version: @@ -311,6 +513,8 @@ 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` + * 2022-01-01-preview: :class:`ServicesOperations` """ api_version = self._get_api_version('services') if api_version == '2019-05-01-preview': @@ -321,6 +525,10 @@ 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 + elif api_version == '2022-01-01-preview': + from .v2022_01_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 +553,8 @@ 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` + * 2022-01-01-preview: :class:`SkusOperations` """ api_version = self._get_api_version('skus') if api_version == '2020-07-01': @@ -353,10 +563,30 @@ 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 + elif api_version == '2022-01-01-preview': + from .v2022_01_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` + * 2022-01-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 + elif api_version == '2022-01-01-preview': + from .v2022_01_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 7ab9f3c3d513..60e24d4ade15 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 401fdc294675..4925e8f584a3 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,8 @@ 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` + * 2022-01-01-preview: :mod:`v2022_01_01_preview.models` """ if api_version == '2019-05-01-preview': from ..v2019_05_01_preview import models @@ -107,8 +107,40 @@ 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 + elif api_version == '2022-01-01-preview': + from ..v2022_01_01_preview import models + return models raise ValueError("API version {} is not available".format(api_version)) + @property + def api_portal_custom_domains(self): + """Instance depends on the API version: + + * 2022-01-01-preview: :class:`ApiPortalCustomDomainsOperations` + """ + api_version = self._get_api_version('api_portal_custom_domains') + if api_version == '2022-01-01-preview': + from ..v2022_01_01_preview.aio.operations import ApiPortalCustomDomainsOperations as OperationClass + else: + raise ValueError("API version {} does not have operation group 'api_portal_custom_domains'".format(api_version)) + return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) + + @property + def api_portals(self): + """Instance depends on the API version: + + * 2022-01-01-preview: :class:`ApiPortalsOperations` + """ + api_version = self._get_api_version('api_portals') + if api_version == '2022-01-01-preview': + from ..v2022_01_01_preview.aio.operations import ApiPortalsOperations as OperationClass + else: + raise ValueError("API version {} does not have operation group 'api_portals'".format(api_version)) + return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) + @property def apps(self): """Instance depends on the API version: @@ -117,6 +149,8 @@ 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` + * 2022-01-01-preview: :class:`AppsOperations` """ api_version = self._get_api_version('apps') if api_version == '2019-05-01-preview': @@ -127,6 +161,10 @@ 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 + elif api_version == '2022-01-01-preview': + from ..v2022_01_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 +177,8 @@ 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` + * 2022-01-01-preview: :class:`BindingsOperations` """ api_version = self._get_api_version('bindings') if api_version == '2019-05-01-preview': @@ -149,10 +189,66 @@ 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 + elif api_version == '2022-01-01-preview': + from ..v2022_01_01_preview.aio.operations import BindingsOperations as OperationClass else: raise ValueError("API version {} does not have operation group 'bindings'".format(api_version)) return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) + @property + def build_service(self): + """Instance depends on the API version: + + * 2022-01-01-preview: :class:`BuildServiceOperations` + """ + api_version = self._get_api_version('build_service') + if api_version == '2022-01-01-preview': + from ..v2022_01_01_preview.aio.operations import BuildServiceOperations as OperationClass + else: + raise ValueError("API version {} does not have operation group 'build_service'".format(api_version)) + return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) + + @property + def build_service_agent_pool(self): + """Instance depends on the API version: + + * 2022-01-01-preview: :class:`BuildServiceAgentPoolOperations` + """ + api_version = self._get_api_version('build_service_agent_pool') + if api_version == '2022-01-01-preview': + from ..v2022_01_01_preview.aio.operations import BuildServiceAgentPoolOperations as OperationClass + else: + raise ValueError("API version {} does not have operation group 'build_service_agent_pool'".format(api_version)) + return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) + + @property + def build_service_builder(self): + """Instance depends on the API version: + + * 2022-01-01-preview: :class:`BuildServiceBuilderOperations` + """ + api_version = self._get_api_version('build_service_builder') + if api_version == '2022-01-01-preview': + from ..v2022_01_01_preview.aio.operations import BuildServiceBuilderOperations as OperationClass + else: + raise ValueError("API version {} does not have operation group 'build_service_builder'".format(api_version)) + return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) + + @property + def buildpack_binding(self): + """Instance depends on the API version: + + * 2022-01-01-preview: :class:`BuildpackBindingOperations` + """ + api_version = self._get_api_version('buildpack_binding') + if api_version == '2022-01-01-preview': + from ..v2022_01_01_preview.aio.operations import BuildpackBindingOperations as OperationClass + else: + raise ValueError("API version {} does not have operation group 'buildpack_binding'".format(api_version)) + return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) + @property def certificates(self): """Instance depends on the API version: @@ -161,6 +257,8 @@ 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` + * 2022-01-01-preview: :class:`CertificatesOperations` """ api_version = self._get_api_version('certificates') if api_version == '2019-05-01-preview': @@ -171,6 +269,10 @@ 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 + elif api_version == '2022-01-01-preview': + from ..v2022_01_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 +284,8 @@ 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` + * 2022-01-01-preview: :class:`ConfigServersOperations` """ api_version = self._get_api_version('config_servers') if api_version == '2020-07-01': @@ -190,10 +294,27 @@ 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 + elif api_version == '2022-01-01-preview': + from ..v2022_01_01_preview.aio.operations import ConfigServersOperations as OperationClass else: raise ValueError("API version {} does not have operation group 'config_servers'".format(api_version)) return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) + @property + def configuration_services(self): + """Instance depends on the API version: + + * 2022-01-01-preview: :class:`ConfigurationServicesOperations` + """ + api_version = self._get_api_version('configuration_services') + if api_version == '2022-01-01-preview': + from ..v2022_01_01_preview.aio.operations import ConfigurationServicesOperations as OperationClass + else: + raise ValueError("API version {} does not have operation group 'configuration_services'".format(api_version)) + return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) + @property def custom_domains(self): """Instance depends on the API version: @@ -202,6 +323,8 @@ 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` + * 2022-01-01-preview: :class:`CustomDomainsOperations` """ api_version = self._get_api_version('custom_domains') if api_version == '2019-05-01-preview': @@ -212,6 +335,10 @@ 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 + elif api_version == '2022-01-01-preview': + from ..v2022_01_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 +351,8 @@ 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` + * 2022-01-01-preview: :class:`DeploymentsOperations` """ api_version = self._get_api_version('deployments') if api_version == '2019-05-01-preview': @@ -234,10 +363,53 @@ 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 + elif api_version == '2022-01-01-preview': + from ..v2022_01_01_preview.aio.operations import DeploymentsOperations as OperationClass else: raise ValueError("API version {} does not have operation group 'deployments'".format(api_version)) return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) + @property + def gateway_custom_domains(self): + """Instance depends on the API version: + + * 2022-01-01-preview: :class:`GatewayCustomDomainsOperations` + """ + api_version = self._get_api_version('gateway_custom_domains') + if api_version == '2022-01-01-preview': + from ..v2022_01_01_preview.aio.operations import GatewayCustomDomainsOperations as OperationClass + else: + raise ValueError("API version {} does not have operation group 'gateway_custom_domains'".format(api_version)) + return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) + + @property + def gateway_route_configs(self): + """Instance depends on the API version: + + * 2022-01-01-preview: :class:`GatewayRouteConfigsOperations` + """ + api_version = self._get_api_version('gateway_route_configs') + if api_version == '2022-01-01-preview': + from ..v2022_01_01_preview.aio.operations import GatewayRouteConfigsOperations as OperationClass + else: + raise ValueError("API version {} does not have operation group 'gateway_route_configs'".format(api_version)) + return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) + + @property + def gateways(self): + """Instance depends on the API version: + + * 2022-01-01-preview: :class:`GatewaysOperations` + """ + api_version = self._get_api_version('gateways') + if api_version == '2022-01-01-preview': + from ..v2022_01_01_preview.aio.operations import GatewaysOperations as OperationClass + else: + raise ValueError("API version {} does not have operation group 'gateways'".format(api_version)) + return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) + @property def monitoring_settings(self): """Instance depends on the API version: @@ -245,6 +417,8 @@ 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` + * 2022-01-01-preview: :class:`MonitoringSettingsOperations` """ api_version = self._get_api_version('monitoring_settings') if api_version == '2020-07-01': @@ -253,6 +427,10 @@ 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 + elif api_version == '2022-01-01-preview': + from ..v2022_01_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 +443,8 @@ 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` + * 2022-01-01-preview: :class:`Operations` """ api_version = self._get_api_version('operations') if api_version == '2019-05-01-preview': @@ -275,6 +455,10 @@ 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 + elif api_version == '2022-01-01-preview': + from ..v2022_01_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 +471,8 @@ 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` + * 2022-01-01-preview: :class:`RuntimeVersionsOperations` """ api_version = self._get_api_version('runtime_versions') if api_version == '2019-05-01-preview': @@ -297,10 +483,27 @@ 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 + elif api_version == '2022-01-01-preview': + from ..v2022_01_01_preview.aio.operations import RuntimeVersionsOperations as OperationClass else: raise ValueError("API version {} does not have operation group 'runtime_versions'".format(api_version)) return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) + @property + def service_registries(self): + """Instance depends on the API version: + + * 2022-01-01-preview: :class:`ServiceRegistriesOperations` + """ + api_version = self._get_api_version('service_registries') + if api_version == '2022-01-01-preview': + from ..v2022_01_01_preview.aio.operations import ServiceRegistriesOperations as OperationClass + else: + raise ValueError("API version {} does not have operation group 'service_registries'".format(api_version)) + return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) + @property def services(self): """Instance depends on the API version: @@ -309,6 +512,8 @@ 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` + * 2022-01-01-preview: :class:`ServicesOperations` """ api_version = self._get_api_version('services') if api_version == '2019-05-01-preview': @@ -319,6 +524,10 @@ 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 + elif api_version == '2022-01-01-preview': + from ..v2022_01_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 +552,8 @@ 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` + * 2022-01-01-preview: :class:`SkusOperations` """ api_version = self._get_api_version('skus') if api_version == '2020-07-01': @@ -351,10 +562,30 @@ 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 + elif api_version == '2022-01-01-preview': + from ..v2022_01_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` + * 2022-01-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 + elif api_version == '2022-01-01-preview': + from ..v2022_01_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 d383d0e07542..10eb9d6f0e9a 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 d2ddf950056a..41ec6d71ff7f 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 82ff1e7eeb21..b6ee849f985d 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,32 +6,22 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING +from copy import deepcopy +from typing import Any, Optional, TYPE_CHECKING +from azure.core.rest import HttpRequest, HttpResponse 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 - -class AppPlatformManagementClient(object): +class AppPlatformManagementClient: """REST API for Azure Spring Cloud. :ivar services: ServicesOperations operations @@ -41,79 +31,82 @@ 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] - **kwargs # type: Any - ): - # type: (...) -> None - if not base_url: - base_url = 'https://management.azure.com' - self._config = AppPlatformManagementClientConfiguration(credential, subscription_id, **kwargs) + credential: "TokenCredential", + 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 = 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: Any + ) -> HttpResponse: """Runs the network request through the client's chained policies. - :param http_request: The network request you want to make. Required. - :type http_request: ~azure.core.pipeline.transport.HttpRequest - :keyword bool stream: Whether the response payload will be streamed. Defaults to True. + >>> 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 18a7e2758d06..c4edf3cbbd23 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 @@ -6,18 +6,16 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING +from typing import Any, TYPE_CHECKING from azure.core.configuration import Configuration from azure.core.pipeline import policies -from azure.mgmt.core.policies import ARMHttpLoggingPolicy +from 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 @@ -35,16 +33,15 @@ class AppPlatformManagementClientConfiguration(Configuration): def __init__( self, - credential, # type: "TokenCredential" - subscription_id, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + credential: "TokenCredential", + 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 @@ -68,4 +65,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 ed50cf259b5e..99eb2299b3fd 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 000000000000..74e48ecd07cf --- /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 000000000000..138f663c53a4 --- /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/aio/__init__.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2019_05_01_preview/aio/__init__.py index 39f105488735..44ce4a5043f8 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 c4e9e2ac7f59..712c3e84a1b1 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 a5e13e26a081..cb170386c761 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 000000000000..74e48ecd07cf --- /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 14016781710c..2241d8383d6d 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 713c34adbbd4..b7f7eb200137 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 b8b4fd414723..e6e9511487da 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 34096d1ba4d1..b29d4a30da36 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 a4d1214cce22..50e49cf08d64 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 8f6523f5508d..5be8a0aac00b 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 9d18f8356140..55d8fc9d5046 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 dc2d77510491..0748b54f3859 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 a7111308ab8f..df141269a814 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 ca288c598cf9..8a405eeb2274 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 @@ -6,138 +6,74 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -try: - from ._models_py3 import AppResource - from ._models_py3 import AppResourceCollection - from ._models_py3 import AppResourceProperties - from ._models_py3 import AvailableOperations - from ._models_py3 import AvailableRuntimeVersions - from ._models_py3 import BindingResource - from ._models_py3 import BindingResourceCollection - from ._models_py3 import BindingResourceProperties - from ._models_py3 import CertificateProperties - from ._models_py3 import CertificateResource - from ._models_py3 import CertificateResourceCollection - from ._models_py3 import CloudErrorBody - from ._models_py3 import ClusterResourceProperties - from ._models_py3 import ConfigServerGitProperty - from ._models_py3 import ConfigServerProperties - from ._models_py3 import ConfigServerSettings - from ._models_py3 import CustomDomainProperties - from ._models_py3 import CustomDomainResource - from ._models_py3 import CustomDomainResourceCollection - from ._models_py3 import CustomDomainValidatePayload - from ._models_py3 import CustomDomainValidateResult - from ._models_py3 import DeploymentInstance - from ._models_py3 import DeploymentResource - from ._models_py3 import DeploymentResourceCollection - from ._models_py3 import DeploymentResourceProperties - from ._models_py3 import DeploymentSettings - from ._models_py3 import Error - from ._models_py3 import GitPatternRepository - 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 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 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 SupportedRuntimeVersion - from ._models_py3 import TemporaryDisk - from ._models_py3 import TestKeys - from ._models_py3 import TraceProperties - 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 AvailableOperations # type: ignore - from ._models import AvailableRuntimeVersions # type: ignore - from ._models import BindingResource # type: ignore - from ._models import BindingResourceCollection # type: ignore - from ._models import BindingResourceProperties # type: ignore - from ._models import CertificateProperties # type: ignore - from ._models import CertificateResource # type: ignore - from ._models import CertificateResourceCollection # type: ignore - from ._models import CloudErrorBody # type: ignore - from ._models import ClusterResourceProperties # type: ignore - from ._models import ConfigServerGitProperty # type: ignore - from ._models import ConfigServerProperties # type: ignore - from ._models import ConfigServerSettings # type: ignore - from ._models import CustomDomainProperties # type: ignore - from ._models import CustomDomainResource # type: ignore - from ._models import CustomDomainResourceCollection # type: ignore - from ._models import CustomDomainValidatePayload # type: ignore - from ._models import CustomDomainValidateResult # type: ignore - from ._models import DeploymentInstance # type: ignore - from ._models import DeploymentResource # type: ignore - from ._models import DeploymentResourceCollection # type: ignore - from ._models import DeploymentResourceProperties # type: ignore - from ._models import DeploymentSettings # type: ignore - from ._models import Error # type: ignore - from ._models import GitPatternRepository # type: ignore - from ._models import LogFileUrlResponse # type: ignore - from ._models import LogSpecification # type: ignore - from ._models import ManagedIdentityProperties # type: ignore - from ._models import MetricDimension # type: ignore - from ._models import MetricSpecification # type: ignore - from ._models import NameAvailability # type: ignore - from ._models import NameAvailabilityParameters # type: ignore - from ._models import NetworkProfile # type: ignore - from ._models import NetworkProfileOutboundIPs # type: ignore - from ._models import OperationDetail # type: ignore - from ._models import OperationDisplay # type: ignore - from ._models import OperationProperties # type: ignore - from ._models import PersistentDisk # type: ignore - from ._models import ProxyResource # type: ignore - from ._models import RegenerateTestKeyRequestPayload # type: ignore - from ._models import RequiredTraffic # type: ignore - from ._models import Resource # type: ignore - from ._models import ResourceSku # type: ignore - from ._models import ResourceSkuCapabilities # type: ignore - from ._models import ResourceSkuCollection # type: ignore - from ._models import ResourceSkuLocationInfo # type: ignore - from ._models import ResourceSkuRestrictionInfo # type: ignore - from ._models import ResourceSkuRestrictions # type: ignore - from ._models import ResourceSkuZoneDetails # type: ignore - from ._models import ResourceUploadDefinition # type: ignore - from ._models import ServiceResource # type: ignore - from ._models import ServiceResourceList # type: ignore - from ._models import ServiceSpecification # type: ignore - from ._models import Sku # type: ignore - from ._models import SkuCapacity # type: ignore - from ._models import SupportedRuntimeVersion # type: ignore - from ._models import TemporaryDisk # type: ignore - from ._models import TestKeys # type: ignore - from ._models import TraceProperties # type: ignore - from ._models import TrackedResource # type: ignore - from ._models import UserSourceInfo # type: ignore +from ._models_py3 import AppResource +from ._models_py3 import AppResourceCollection +from ._models_py3 import AppResourceProperties +from ._models_py3 import AvailableOperations +from ._models_py3 import AvailableRuntimeVersions +from ._models_py3 import BindingResource +from ._models_py3 import BindingResourceCollection +from ._models_py3 import BindingResourceProperties +from ._models_py3 import CertificateProperties +from ._models_py3 import CertificateResource +from ._models_py3 import CertificateResourceCollection +from ._models_py3 import CloudErrorBody +from ._models_py3 import ClusterResourceProperties +from ._models_py3 import ConfigServerGitProperty +from ._models_py3 import ConfigServerProperties +from ._models_py3 import ConfigServerSettings +from ._models_py3 import CustomDomainProperties +from ._models_py3 import CustomDomainResource +from ._models_py3 import CustomDomainResourceCollection +from ._models_py3 import CustomDomainValidatePayload +from ._models_py3 import CustomDomainValidateResult +from ._models_py3 import DeploymentInstance +from ._models_py3 import DeploymentResource +from ._models_py3 import DeploymentResourceCollection +from ._models_py3 import DeploymentResourceProperties +from ._models_py3 import DeploymentSettings +from ._models_py3 import Error +from ._models_py3 import GitPatternRepository +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 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 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 SupportedRuntimeVersion +from ._models_py3 import TemporaryDisk +from ._models_py3 import TestKeys +from ._models_py3 import TraceProperties +from ._models_py3 import TrackedResource +from ._models_py3 import UserSourceInfo + from ._app_platform_management_client_enums import ( + ActionType, AppResourceProvisioningState, ConfigServerState, DeploymentResourceProvisioningState, @@ -221,6 +157,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 21a74a5c953c..e351bdb7c338 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 deleted file mode 100644 index 8e0cc5fe573b..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2019_05_01_preview/models/_models.py +++ /dev/null @@ -1,2246 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -import msrest.serialization - - -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 - :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 - """ - - _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 - ): - 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. - - :param value: Collection of App resources. - :type value: list[~azure.mgmt.appplatform.v2019_05_01_preview.models.AppResource] - :param next_link: URL client should use to fetch the next page (per server side paging). - It's null for now, added for future use. - :type next_link: str - """ - - _attribute_map = { - 'value': {'key': 'value', 'type': '[AppResource]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(AppResourceCollection, self).__init__(**kwargs) - self.value = kwargs.get('value', None) - self.next_link = kwargs.get('next_link', None) - - -class AppResourceProperties(msrest.serialization.Model): - """App resource properties payload. - - Variables are only populated by the server, and will be ignored when sending a request. - - :param public: Indicates whether the App exposes public endpoint. - :type 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 created_time: Date time when the resource is created. - :vartype created_time: ~datetime.datetime - :param temporary_disk: Temporary disk settings. - :type temporary_disk: ~azure.mgmt.appplatform.v2019_05_01_preview.models.TemporaryDisk - :param persistent_disk: Persistent disk settings. - :type persistent_disk: ~azure.mgmt.appplatform.v2019_05_01_preview.models.PersistentDisk - """ - - _validation = { - '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'}, - } - - def __init__( - self, - **kwargs - ): - super(AppResourceProperties, self).__init__(**kwargs) - self.public = kwargs.get('public', None) - self.url = None - self.provisioning_state = None - self.active_deployment_name = kwargs.get('active_deployment_name', None) - self.fqdn = kwargs.get('fqdn', None) - self.https_only = kwargs.get('https_only', False) - self.created_time = None - self.temporary_disk = kwargs.get('temporary_disk', None) - self.persistent_disk = kwargs.get('persistent_disk', None) - - -class AvailableOperations(msrest.serialization.Model): - """Available operations of the service. - - :param value: Collection of available operation details. - :type value: list[~azure.mgmt.appplatform.v2019_05_01_preview.models.OperationDetail] - :param next_link: URL client should use to fetch the next page (per server side paging). - It's null for now, added for future use. - :type next_link: str - """ - - _attribute_map = { - 'value': {'key': 'value', 'type': '[OperationDetail]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(AvailableOperations, self).__init__(**kwargs) - self.value = kwargs.get('value', None) - self.next_link = kwargs.get('next_link', None) - - -class AvailableRuntimeVersions(msrest.serialization.Model): - """AvailableRuntimeVersions. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar value: A list of all supported runtime versions. - :vartype value: - list[~azure.mgmt.appplatform.v2019_05_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 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 - :param properties: Properties of the Binding resource. - :type properties: ~azure.mgmt.appplatform.v2019_05_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 - ): - 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. - - :param value: Collection of Binding resources. - :type value: list[~azure.mgmt.appplatform.v2019_05_01_preview.models.BindingResource] - :param next_link: URL client should use to fetch the next page (per server side paging). - It's null for now, added for future use. - :type next_link: str - """ - - _attribute_map = { - 'value': {'key': 'value', 'type': '[BindingResource]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(BindingResourceCollection, self).__init__(**kwargs) - self.value = kwargs.get('value', None) - self.next_link = kwargs.get('next_link', None) - - -class BindingResourceProperties(msrest.serialization.Model): - """Binding resource properties payload. - - Variables are only populated by the server, and will be ignored when sending a request. - - :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 - :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 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 - ): - 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. - - 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 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 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 = { - 'thumbprint': {'readonly': True}, - 'vault_uri': {'required': True}, - 'key_vault_cert_name': {'required': 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 = { - 'thumbprint': {'key': 'thumbprint', 'type': 'str'}, - 'vault_uri': {'key': 'vaultUri', 'type': 'str'}, - 'key_vault_cert_name': {'key': 'keyVaultCertName', 'type': 'str'}, - 'cert_version': {'key': 'certVersion', '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]'}, - } - - def __init__( - self, - **kwargs - ): - super(CertificateProperties, self).__init__(**kwargs) - self.thumbprint = None - self.vault_uri = kwargs['vault_uri'] - self.key_vault_cert_name = kwargs['key_vault_cert_name'] - self.cert_version = kwargs.get('cert_version', None) - self.issuer = None - self.issued_date = None - 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 - :param properties: Properties of the certificate resource payload. - :type properties: ~azure.mgmt.appplatform.v2019_05_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 - ): - 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. - - :param value: The certificate resources list. - :type value: list[~azure.mgmt.appplatform.v2019_05_01_preview.models.CertificateResource] - :param next_link: The link to next page of certificate list. - :type next_link: str - """ - - _attribute_map = { - 'value': {'key': 'value', 'type': '[CertificateResource]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(CertificateResourceCollection, self).__init__(**kwargs) - self.value = kwargs.get('value', None) - self.next_link = kwargs.get('next_link', None) - - -class CloudErrorBody(msrest.serialization.Model): - """An error response from the service. - - :param code: An identifier for the error. Codes are invariant and are intended to be consumed - programmatically. - :type code: str - :param message: A message describing the error, intended to be suitable for display in a user - interface. - :type message: str - :param target: The target of the particular error. For example, the name of the property in - error. - :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] - """ - - _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 - ): - 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.v2019_05_01_preview.models.ProvisioningState - :param config_server_properties: Config server git properties of the Service. - :type config_server_properties: - ~azure.mgmt.appplatform.v2019_05_01_preview.models.ConfigServerProperties - :param trace: Trace properties of the Service. - :type trace: ~azure.mgmt.appplatform.v2019_05_01_preview.models.TraceProperties - :param network_profile: Network profile of the Service. - :type network_profile: ~azure.mgmt.appplatform.v2019_05_01_preview.models.NetworkProfile - :ivar version: Version of the Service. - :vartype version: int - :ivar service_id: ServiceInstanceEntity GUID which uniquely identifies a created resource. - :vartype service_id: str - """ - - _validation = { - 'provisioning_state': {'readonly': True}, - 'version': {'readonly': True}, - 'service_id': {'readonly': True}, - } - - _attribute_map = { - 'provisioning_state': {'key': 'provisioningState', 'type': 'str'}, - 'config_server_properties': {'key': 'configServerProperties', 'type': 'ConfigServerProperties'}, - 'trace': {'key': 'trace', 'type': 'TraceProperties'}, - 'network_profile': {'key': 'networkProfile', 'type': 'NetworkProfile'}, - 'version': {'key': 'version', 'type': 'int'}, - 'service_id': {'key': 'serviceId', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(ClusterResourceProperties, self).__init__(**kwargs) - self.provisioning_state = None - self.config_server_properties = kwargs.get('config_server_properties', None) - self.trace = kwargs.get('trace', None) - self.network_profile = kwargs.get('network_profile', None) - self.version = None - self.service_id = None - - -class ConfigServerGitProperty(msrest.serialization.Model): - """Property of git. - - All required parameters must be populated in order to send to Azure. - - :param repositories: Repositories of git. - :type repositories: - list[~azure.mgmt.appplatform.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 - """ - - _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 - ): - 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 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 - """ - - _validation = { - 'state': {'readonly': True}, - } - - _attribute_map = { - 'state': {'key': 'state', 'type': 'str'}, - 'error': {'key': 'error', 'type': 'Error'}, - 'config_server': {'key': 'configServer', 'type': 'ConfigServerSettings'}, - } - - def __init__( - self, - **kwargs - ): - super(ConfigServerProperties, self).__init__(**kwargs) - self.state = None - self.error = kwargs.get('error', None) - self.config_server = kwargs.get('config_server', None) - - -class ConfigServerSettings(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 - """ - - _attribute_map = { - 'git_property': {'key': 'gitProperty', 'type': 'ConfigServerGitProperty'}, - } - - def __init__( - self, - **kwargs - ): - super(ConfigServerSettings, self).__init__(**kwargs) - self.git_property = kwargs.get('git_property', 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. - - :param thumbprint: The thumbprint of bound certificate. - :type 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 - """ - - _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 - ): - 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 - :param properties: Properties of the custom domain resource. - :type properties: ~azure.mgmt.appplatform.v2019_05_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 - ): - 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. - - :param value: The custom domain resources list. - :type value: list[~azure.mgmt.appplatform.v2019_05_01_preview.models.CustomDomainResource] - :param next_link: The link to next page of custom domain list. - :type next_link: str - """ - - _attribute_map = { - 'value': {'key': 'value', 'type': '[CustomDomainResource]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(CustomDomainResourceCollection, self).__init__(**kwargs) - self.value = kwargs.get('value', None) - self.next_link = kwargs.get('next_link', None) - - -class CustomDomainValidatePayload(msrest.serialization.Model): - """Custom domain validate payload. - - All required parameters must be populated in order to send to Azure. - - :param name: Required. Name to be validated. - :type name: str - """ - - _validation = { - 'name': {'required': True}, - } - - _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(CustomDomainValidatePayload, self).__init__(**kwargs) - self.name = kwargs['name'] - - -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 - """ - - _attribute_map = { - 'is_valid': {'key': 'isValid', 'type': 'bool'}, - 'message': {'key': 'message', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(CustomDomainValidateResult, self).__init__(**kwargs) - self.is_valid = kwargs.get('is_valid', None) - self.message = kwargs.get('message', None) - - -class DeploymentInstance(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 - :param properties: Properties of the Deployment resource. - :type properties: - ~azure.mgmt.appplatform.v2019_05_01_preview.models.DeploymentResourceProperties - :param sku: Sku of the Deployment resource. - :type sku: ~azure.mgmt.appplatform.v2019_05_01_preview.models.Sku - """ - - _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 - ): - 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. - - :param value: Collection of Deployment resources. - :type value: list[~azure.mgmt.appplatform.v2019_05_01_preview.models.DeploymentResource] - :param next_link: URL client should use to fetch the next page (per server side paging). - It's null for now, added for future use. - :type next_link: str - """ - - _attribute_map = { - 'value': {'key': 'value', 'type': '[DeploymentResource]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(DeploymentResourceCollection, self).__init__(**kwargs) - self.value = kwargs.get('value', None) - self.next_link = kwargs.get('next_link', None) - - -class DeploymentResourceProperties(msrest.serialization.Model): - """Deployment resource properties payload. - - Variables are only populated by the server, and will be ignored when sending a request. - - :param source: Uploaded source information of the deployment. - :type source: ~azure.mgmt.appplatform.v2019_05_01_preview.models.UserSourceInfo - :ivar app_name: App name of the deployment. - :vartype app_name: str - :param deployment_settings: Deployment settings of the Deployment. - :type deployment_settings: - ~azure.mgmt.appplatform.v2019_05_01_preview.models.DeploymentSettings - :ivar provisioning_state: Provisioning state of the Deployment. Possible values include: - "Creating", "Updating", "Succeeded", "Failed", "Deleting". - :vartype provisioning_state: str or - ~azure.mgmt.appplatform.v2019_05_01_preview.models.DeploymentResourceProvisioningState - :ivar status: Status of the Deployment. Possible values include: "Unknown", "Stopped", - "Running", "Failed", "Allocating", "Upgrading", "Compiling". - :vartype status: str or - ~azure.mgmt.appplatform.v2019_05_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.v2019_05_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 - ): - 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. - - :param cpu: Required CPU, basic tier should be 1, standard tier should be in range (1, 4). - :type cpu: int - :param memory_in_gb: Required Memory size in GB, basic tier should be in range (1, 2), standard - tier should be in range (1, 8). - :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 - 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", - "NetCore_31". Default value: "Java_8". - :type runtime_version: str or ~azure.mgmt.appplatform.v2019_05_01_preview.models.RuntimeVersion - """ - - _attribute_map = { - 'cpu': {'key': 'cpu', 'type': 'int'}, - 'memory_in_gb': {'key': 'memoryInGB', 'type': 'int'}, - 'jvm_options': {'key': 'jvmOptions', 'type': 'str'}, - 'net_core_main_entry_path': {'key': 'netCoreMainEntryPath', 'type': 'str'}, - 'instance_count': {'key': 'instanceCount', 'type': 'int'}, - 'environment_variables': {'key': 'environmentVariables', 'type': '{str}'}, - 'runtime_version': {'key': 'runtimeVersion', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(DeploymentSettings, self).__init__(**kwargs) - self.cpu = kwargs.get('cpu', 1) - self.memory_in_gb = kwargs.get('memory_in_gb', 1) - self.jvm_options = kwargs.get('jvm_options', None) - self.net_core_main_entry_path = kwargs.get('net_core_main_entry_path', None) - self.instance_count = kwargs.get('instance_count', 1) - self.environment_variables = kwargs.get('environment_variables', 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 - """ - - _attribute_map = { - 'code': {'key': 'code', 'type': 'str'}, - 'message': {'key': 'message', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - 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. - - :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 - """ - - _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 - ): - 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 LogFileUrlResponse(msrest.serialization.Model): - """Log file URL payload. - - All required parameters must be populated in order to send to Azure. - - :param url: Required. URL of the log file. - :type url: str - """ - - _validation = { - 'url': {'required': True}, - } - - _attribute_map = { - 'url': {'key': 'url', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(LogFileUrlResponse, self).__init__(**kwargs) - self.url = kwargs['url'] - - -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 - """ - - _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'display_name': {'key': 'displayName', 'type': 'str'}, - 'blob_duration': {'key': 'blobDuration', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(LogSpecification, self).__init__(**kwargs) - self.name = kwargs.get('name', None) - self.display_name = kwargs.get('display_name', None) - self.blob_duration = kwargs.get('blob_duration', None) - - -class ManagedIdentityProperties(msrest.serialization.Model): - """Managed identity properties retrieved from ARM request headers. - - :param type: Possible values include: "None", "SystemAssigned", "UserAssigned", - "SystemAssigned,UserAssigned". - :type type: str or ~azure.mgmt.appplatform.v2019_05_01_preview.models.ManagedIdentityType - :param principal_id: - :type principal_id: str - :param tenant_id: - :type 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 - ): - 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. - - :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 - export scenario. - :type to_be_exported_for_shoebox: bool - """ - - _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'display_name': {'key': 'displayName', 'type': 'str'}, - 'to_be_exported_for_shoebox': {'key': 'toBeExportedForShoebox', 'type': 'bool'}, - } - - def __init__( - self, - **kwargs - ): - 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. - - :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 - belong to a single category. - :type category: str - :param aggregation_type: Only provide one value for this field. Valid values: Average, Minimum, - Maximum, Total, Count. - :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 - 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] - """ - - _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]'}, - } - - def __init__( - self, - **kwargs - ): - 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) - - -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 - """ - - _attribute_map = { - 'name_available': {'key': 'nameAvailable', 'type': 'bool'}, - 'reason': {'key': 'reason', 'type': 'str'}, - 'message': {'key': 'message', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(NameAvailability, self).__init__(**kwargs) - self.name_available = kwargs.get('name_available', None) - self.reason = kwargs.get('reason', None) - self.message = kwargs.get('message', None) - - -class NameAvailabilityParameters(msrest.serialization.Model): - """Name availability parameters payload. - - All required parameters must be populated in order to send to Azure. - - :param type: Required. Type of the resource to check name availability. - :type type: str - :param name: Required. Name to be checked. - :type 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 - ): - 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. - - :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 - resources of Azure Spring Cloud Service Runtime. - :type service_runtime_network_resource_group: str - :param app_network_resource_group: Name of the resource group containing network resources of - Azure Spring Cloud Apps. - :type 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 - :ivar required_traffics: Required inbound or outbound traffics for Azure Spring Cloud instance. - :vartype required_traffics: - list[~azure.mgmt.appplatform.v2019_05_01_preview.models.RequiredTraffic] - """ - - _validation = { - 'outbound_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 - ): - 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. - - :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 - """ - - _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'is_data_action': {'key': 'isDataAction', 'type': 'bool'}, - 'display': {'key': 'display', 'type': 'OperationDisplay'}, - 'origin': {'key': 'origin', 'type': 'str'}, - 'properties': {'key': 'properties', 'type': 'OperationProperties'}, - } - - def __init__( - self, - **kwargs - ): - super(OperationDetail, self).__init__(**kwargs) - self.name = kwargs.get('name', None) - self.is_data_action = kwargs.get('is_data_action', None) - self.display = kwargs.get('display', None) - self.origin = kwargs.get('origin', None) - self.properties = kwargs.get('properties', None) - - -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 - """ - - _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 - ): - 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. - - :param service_specification: Service specifications of the operation. - :type service_specification: - ~azure.mgmt.appplatform.v2019_05_01_preview.models.ServiceSpecification - """ - - _attribute_map = { - 'service_specification': {'key': 'serviceSpecification', 'type': 'ServiceSpecification'}, - } - - def __init__( - self, - **kwargs - ): - 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. - - :param size_in_gb: Size of the persistent disk in GB. - :type size_in_gb: int - :ivar used_in_gb: Size of the used persistent disk in GB. - :vartype used_in_gb: int - :param mount_path: Mount path of the persistent disk. - :type 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 - ): - 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. - - :param key_type: Required. Type of the test key. Possible values include: "Primary", - "Secondary". - :type key_type: str or ~azure.mgmt.appplatform.v2019_05_01_preview.models.TestKeyType - """ - - _validation = { - 'key_type': {'required': True}, - } - - _attribute_map = { - 'key_type': {'key': 'keyType', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - 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.v2019_05_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 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 - the SKU is available. - :type location_info: - list[~azure.mgmt.appplatform.v2019_05_01_preview.models.ResourceSkuLocationInfo] - :param restrictions: Gets the restrictions because of which SKU cannot be used. This is - empty if there are no restrictions. - :type restrictions: - list[~azure.mgmt.appplatform.v2019_05_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 - ): - 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. - - :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 - """ - - _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'value': {'key': 'value', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(ResourceSkuCapabilities, self).__init__(**kwargs) - self.name = kwargs.get('name', None) - self.value = kwargs.get('value', None) - - -class ResourceSkuCollection(msrest.serialization.Model): - """ResourceSkuCollection. - - :param value: Collection of resource SKU. - :type value: list[~azure.mgmt.appplatform.v2019_05_01_preview.models.ResourceSku] - :param next_link: URL client should use to fetch the next page (per server side paging). - It's null for now, added for future use. - :type next_link: str - """ - - _attribute_map = { - 'value': {'key': 'value', 'type': '[ResourceSku]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(ResourceSkuCollection, self).__init__(**kwargs) - self.value = kwargs.get('value', None) - self.next_link = kwargs.get('next_link', None) - - -class ResourceSkuLocationInfo(msrest.serialization.Model): - """ResourceSkuLocationInfo. - - :param location: Gets location of the SKU. - :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.v2019_05_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 - ): - 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): - """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] - """ - - _attribute_map = { - 'locations': {'key': 'locations', 'type': '[str]'}, - 'zones': {'key': 'zones', 'type': '[str]'}, - } - - def __init__( - self, - **kwargs - ): - super(ResourceSkuRestrictionInfo, self).__init__(**kwargs) - self.locations = kwargs.get('locations', None) - self.zones = kwargs.get('zones', None) - - -class ResourceSkuRestrictions(msrest.serialization.Model): - """ResourceSkuRestrictions. - - :param type: Gets the type of restrictions. Possible values include: 'Location', 'Zone'. - Possible values include: "Location", "Zone". - :type type: str or - ~azure.mgmt.appplatform.v2019_05_01_preview.models.ResourceSkuRestrictionsType - :param values: Gets the value of restrictions. If the restriction type is set to - location. This would be different locations where the SKU is restricted. - :type values: list[str] - :param restriction_info: Gets the information about the restriction where the SKU cannot be - used. - :type restriction_info: - ~azure.mgmt.appplatform.v2019_05_01_preview.models.ResourceSkuRestrictionInfo - :param reason_code: Gets the reason for restriction. Possible values include: 'QuotaId', - 'NotAvailableForSubscription'. Possible values include: "QuotaId", - "NotAvailableForSubscription". - :type reason_code: str or - ~azure.mgmt.appplatform.v2019_05_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 - ): - 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): - """ResourceSkuZoneDetails. - - :param name: Gets the set of zones that the SKU is available in with the - specified capabilities. - :type name: list[str] - :param capabilities: Gets a list of capabilities that are available for the SKU in the - specified list of zones. - :type capabilities: - list[~azure.mgmt.appplatform.v2019_05_01_preview.models.ResourceSkuCapabilities] - """ - - _attribute_map = { - 'name': {'key': 'name', 'type': '[str]'}, - 'capabilities': {'key': 'capabilities', 'type': '[ResourceSkuCapabilities]'}, - } - - def __init__( - self, - **kwargs - ): - 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. - - :param relative_path: Source relative path. - :type relative_path: str - :param upload_url: Upload URL. - :type upload_url: str - """ - - _attribute_map = { - 'relative_path': {'key': 'relativePath', 'type': 'str'}, - 'upload_url': {'key': 'uploadUrl', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(ResourceUploadDefinition, self).__init__(**kwargs) - self.relative_path = kwargs.get('relative_path', None) - self.upload_url = kwargs.get('upload_url', None) - - -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 - :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] - """ - - _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 - ): - 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 - :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 - """ - - _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 - ): - 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. - - :param value: Collection of Service resources. - :type value: list[~azure.mgmt.appplatform.v2019_05_01_preview.models.ServiceResource] - :param next_link: URL client should use to fetch the next page (per server side paging). - It's null for now, added for future use. - :type next_link: str - """ - - _attribute_map = { - 'value': {'key': 'value', 'type': '[ServiceResource]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(ServiceResourceList, self).__init__(**kwargs) - self.value = kwargs.get('value', None) - self.next_link = kwargs.get('next_link', None) - - -class ServiceSpecification(msrest.serialization.Model): - """Service specification payload. - - :param log_specifications: Specifications of the Log for Azure Monitoring. - :type 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: - list[~azure.mgmt.appplatform.v2019_05_01_preview.models.MetricSpecification] - """ - - _attribute_map = { - 'log_specifications': {'key': 'logSpecifications', 'type': '[LogSpecification]'}, - 'metric_specifications': {'key': 'metricSpecifications', 'type': '[MetricSpecification]'}, - } - - def __init__( - self, - **kwargs - ): - super(ServiceSpecification, self).__init__(**kwargs) - self.log_specifications = kwargs.get('log_specifications', None) - self.metric_specifications = kwargs.get('metric_specifications', None) - - -class Sku(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 - """ - - _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'tier': {'key': 'tier', 'type': 'str'}, - 'capacity': {'key': 'capacity', 'type': 'int'}, - } - - def __init__( - self, - **kwargs - ): - super(Sku, self).__init__(**kwargs) - self.name = kwargs.get('name', "S0") - self.tier = kwargs.get('tier', "Standard") - self.capacity = kwargs.get('capacity', None) - - -class SkuCapacity(msrest.serialization.Model): - """The SKU capacity. - - 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", - "Manual", "Automatic". - :type scale_type: str or ~azure.mgmt.appplatform.v2019_05_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 - ): - 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 SupportedRuntimeVersion(msrest.serialization.Model): - """Supported deployment runtime version descriptor. - - :param value: The raw value which could be passed to deployment CRUD operations. Possible - values include: "Java_8", "Java_11", "NetCore_31". - :type value: str or ~azure.mgmt.appplatform.v2019_05_01_preview.models.SupportedRuntimeValue - :param platform: The platform of this runtime version (possible values: "Java" or ".NET"). - Possible values include: "Java", ".NET Core". - :type 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 - """ - - _attribute_map = { - 'value': {'key': 'value', 'type': 'str'}, - 'platform': {'key': 'platform', 'type': 'str'}, - 'version': {'key': 'version', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(SupportedRuntimeVersion, self).__init__(**kwargs) - self.value = kwargs.get('value', None) - self.platform = kwargs.get('platform', None) - self.version = kwargs.get('version', None) - - -class TemporaryDisk(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 - """ - - _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 - ): - 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. - - :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 - """ - - _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 - ): - 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 TraceProperties(msrest.serialization.Model): - """Trace properties payload. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar state: State of the trace proxy. Possible values include: "NotAvailable", "Failed", - "Succeeded", "Updating". - :vartype state: str or ~azure.mgmt.appplatform.v2019_05_01_preview.models.TraceProxyState - :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 - """ - - _validation = { - 'state': {'readonly': True}, - } - - _attribute_map = { - 'state': {'key': 'state', 'type': 'str'}, - 'error': {'key': 'error', 'type': 'Error'}, - 'enabled': {'key': 'enabled', 'type': 'bool'}, - 'app_insight_instrumentation_key': {'key': 'appInsightInstrumentationKey', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(TraceProperties, self).__init__(**kwargs) - self.state = None - self.error = kwargs.get('error', None) - self.enabled = kwargs.get('enabled', None) - self.app_insight_instrumentation_key = kwargs.get('app_insight_instrumentation_key', None) - - -class UserSourceInfo(msrest.serialization.Model): - """Source information for a deployment. - - :param type: Type of the source uploaded. Possible values include: "Jar", "NetCoreZip", - "Source". - :type type: str or ~azure.mgmt.appplatform.v2019_05_01_preview.models.UserSourceType - :param relative_path: Relative path of the storage which stores the source. - :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 - multi-module projects. This should be - the relative path to the target module/project. - :type artifact_selector: str - """ - - _attribute_map = { - 'type': {'key': 'type', 'type': 'str'}, - 'relative_path': {'key': 'relativePath', 'type': 'str'}, - 'version': {'key': 'version', 'type': 'str'}, - 'artifact_selector': {'key': 'artifactSelector', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(UserSourceInfo, self).__init__(**kwargs) - self.type = kwargs.get('type', None) - self.relative_path = kwargs.get('relative_path', None) - self.version = kwargs.get('version', None) - self.artifact_selector = kwargs.get('artifact_selector', None) 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 2538ba5505b8..50e62e72ced1 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 3f791b544673..7ab40829e593 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,25 +5,270 @@ # 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 +import functools +from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union 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 - -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]] +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +JSONType = Any +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_get_request( + subscription_id: str, + resource_group_name: str, + service_name: str, + app_name: str, + *, + sync_status: Optional[str] = None, + **kwargs: Any +) -> 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') + 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: str, + resource_group_name: str, + service_name: str, + app_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> 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, + json=json, + content=content, + **kwargs + ) + + +def build_delete_request( + subscription_id: str, + resource_group_name: str, + service_name: str, + app_name: str, + **kwargs: Any +) -> 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: str, + resource_group_name: str, + service_name: str, + app_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> 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, + json=json, + content=content, + **kwargs + ) + + +def build_list_request( + subscription_id: str, + resource_group_name: str, + service_name: str, + **kwargs: Any +) -> 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: str, + resource_group_name: str, + service_name: str, + app_name: str, + **kwargs: Any +) -> 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 + ) class AppsOperations(object): """AppsOperations operations. @@ -47,15 +292,15 @@ def __init__(self, client, config, serializer, deserializer): 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" + 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 @@ -77,30 +322,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,49 +348,40 @@ 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 - service_name, # type: str - app_name, # type: str - app_resource, # type: "_models.AppResource" - **kwargs # type: Any - ): - # type: (...) -> "_models.AppResource" + resource_group_name: str, + service_name: str, + app_name: str, + app_resource: "_models.AppResource", + **kwargs: Any + ) -> "_models.AppResource": cls = kwargs.pop('cls', None) # type: ClsType["_models.AppResource"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-05-01-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._create_or_update_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - 'appName': self._serialize.url("app_name", app_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + 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 @@ -174,17 +399,19 @@ 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 - service_name, # type: str - app_name, # type: str - app_resource, # type: "_models.AppResource" - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.AppResource"] + resource_group_name: str, + service_name: str, + app_name: str, + app_resource: "_models.AppResource", + **kwargs: Any + ) -> 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 @@ -198,15 +425,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 +451,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,16 +477,17 @@ 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 - service_name, # type: str - app_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + resource_group_name: str, + service_name: str, + app_name: str, + **kwargs: Any + ) -> None: """Operation to delete an App. :param resource_group_name: The name of the resource group that contains the resource. You can @@ -281,28 +507,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,47 +531,37 @@ 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 - service_name, # type: str - app_name, # type: str - app_resource, # type: "_models.AppResource" - **kwargs # type: Any - ): - # type: (...) -> "_models.AppResource" + resource_group_name: str, + service_name: str, + app_name: str, + app_resource: "_models.AppResource", + **kwargs: Any + ) -> "_models.AppResource": cls = kwargs.pop('cls', None) # type: ClsType["_models.AppResource"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-05-01-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._update_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - 'appName': self._serialize.url("app_name", app_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + 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,17 +579,19 @@ 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 - service_name, # type: str - app_name, # type: str - app_resource, # type: "_models.AppResource" - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.AppResource"] + resource_group_name: str, + service_name: str, + app_name: str, + app_resource: "_models.AppResource", + **kwargs: Any + ) -> 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 @@ -397,15 +605,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 +631,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,15 +657,16 @@ 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 - service_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.AppResourceCollection"] + resource_group_name: str, + service_name: str, + **kwargs: Any + ) -> 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 @@ -468,8 +675,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 +686,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,19 +730,20 @@ 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 - service_name, # type: str - app_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.ResourceUploadDefinition" + 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 @@ -556,28 +763,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 +788,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 9b4619882051..c0390633b424 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,23 +5,237 @@ # 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 +import functools +from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar 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 - -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]] +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +JSONType = Any +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_get_request( + subscription_id: str, + resource_group_name: str, + service_name: str, + app_name: str, + binding_name: str, + **kwargs: Any +) -> 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: str, + resource_group_name: str, + service_name: str, + app_name: str, + binding_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> 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, + json=json, + content=content, + **kwargs + ) + + +def build_delete_request( + subscription_id: str, + resource_group_name: str, + service_name: str, + app_name: str, + binding_name: str, + **kwargs: Any +) -> 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: str, + resource_group_name: str, + service_name: str, + app_name: str, + binding_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> 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, + json=json, + content=content, + **kwargs + ) + + +def build_list_request( + subscription_id: str, + resource_group_name: str, + service_name: str, + app_name: str, + **kwargs: Any +) -> 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 + ) class BindingsOperations(object): """BindingsOperations operations. @@ -45,15 +259,15 @@ def __init__(self, client, config, serializer, deserializer): 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" + 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 @@ -75,29 +289,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,18 +315,20 @@ 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 - service_name, # type: str - app_name, # type: str - binding_name, # type: str - binding_resource, # type: "_models.BindingResource" - **kwargs # type: Any - ): - # type: (...) -> "_models.BindingResource" + resource_group_name: str, + service_name: str, + app_name: str, + binding_name: str, + binding_resource: "_models.BindingResource", + **kwargs: Any + ) -> "_models.BindingResource": """Create a new Binding or update an exiting Binding. :param resource_group_name: The name of the resource group that contains the resource. You can @@ -146,34 +352,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,17 +383,19 @@ 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 - service_name, # type: str - app_name, # type: str - binding_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + resource_group_name: str, + service_name: str, + app_name: str, + binding_name: str, + **kwargs: Any + ) -> None: """Operation to delete a Binding. :param resource_group_name: The name of the resource group that contains the resource. You can @@ -219,29 +417,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,16 +442,17 @@ 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 - service_name, # type: str - app_name, # type: str - binding_name, # type: str - binding_resource, # type: "_models.BindingResource" - **kwargs # type: Any - ): - # type: (...) -> "_models.BindingResource" + resource_group_name: str, + service_name: str, + app_name: str, + binding_name: str, + binding_resource: "_models.BindingResource", + **kwargs: Any + ) -> "_models.BindingResource": """Operation to update an exiting Binding. :param resource_group_name: The name of the resource group that contains the resource. You can @@ -287,34 +476,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,16 +507,18 @@ 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 - service_name, # type: str - app_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.BindingResourceCollection"] + resource_group_name: str, + service_name: str, + app_name: str, + **kwargs: Any + ) -> 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 @@ -348,8 +529,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 +540,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 +586,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 2278aec78e3f..5d28304edde6 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,23 +5,181 @@ # 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 +import functools +from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar 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 - -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]] +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +JSONType = Any +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_get_request( + subscription_id: str, + resource_group_name: str, + service_name: str, + certificate_name: str, + **kwargs: Any +) -> 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: str, + resource_group_name: str, + service_name: str, + certificate_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> 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, + json=json, + content=content, + **kwargs + ) + + +def build_delete_request( + subscription_id: str, + resource_group_name: str, + service_name: str, + certificate_name: str, + **kwargs: Any +) -> 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: str, + resource_group_name: str, + service_name: str, + **kwargs: Any +) -> 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 + ) class CertificatesOperations(object): """CertificatesOperations operations. @@ -45,14 +203,14 @@ def __init__(self, client, config, serializer, deserializer): 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" + 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 @@ -72,28 +230,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,17 +255,19 @@ 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 - service_name, # type: str - certificate_name, # type: str - certificate_resource, # type: "_models.CertificateResource" - **kwargs # type: Any - ): - # type: (...) -> "_models.CertificateResource" + resource_group_name: str, + service_name: str, + certificate_name: str, + certificate_resource: "_models.CertificateResource", + **kwargs: Any + ) -> "_models.CertificateResource": """Create or update certificate resource. :param resource_group_name: The name of the resource group that contains the resource. You can @@ -128,7 +278,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 +290,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,16 +320,18 @@ 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 - service_name, # type: str - certificate_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + resource_group_name: str, + service_name: str, + certificate_name: str, + **kwargs: Any + ) -> None: """Delete the certificate resource. :param resource_group_name: The name of the resource group that contains the resource. You can @@ -208,28 +351,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,13 +375,14 @@ 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 - service_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.CertificateResourceCollection"] + resource_group_name: str, + service_name: str, + **kwargs: Any + ) -> 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 @@ -257,8 +391,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 +402,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 +446,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 9f096ceaa361..63530b8b00e3 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,23 +5,283 @@ # 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 +import functools +from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar 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 - -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]] +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +JSONType = Any +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_get_request( + subscription_id: str, + resource_group_name: str, + service_name: str, + app_name: str, + domain_name: str, + **kwargs: Any +) -> 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: str, + resource_group_name: str, + service_name: str, + app_name: str, + domain_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> 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, + json=json, + content=content, + **kwargs + ) + + +def build_delete_request( + subscription_id: str, + resource_group_name: str, + service_name: str, + app_name: str, + domain_name: str, + **kwargs: Any +) -> 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: str, + resource_group_name: str, + service_name: str, + app_name: str, + domain_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> 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, + json=json, + content=content, + **kwargs + ) + + +def build_list_request( + subscription_id: str, + resource_group_name: str, + service_name: str, + app_name: str, + **kwargs: Any +) -> 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: str, + resource_group_name: str, + service_name: str, + app_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> 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, + json=json, + content=content, + **kwargs + ) class CustomDomainsOperations(object): """CustomDomainsOperations operations. @@ -45,15 +305,15 @@ def __init__(self, client, config, serializer, deserializer): 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" + 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 @@ -75,29 +335,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,18 +361,20 @@ 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 - service_name, # type: str - app_name, # type: str - domain_name, # type: str - domain_resource, # type: "_models.CustomDomainResource" - **kwargs # type: Any - ): - # type: (...) -> "_models.CustomDomainResource" + resource_group_name: str, + service_name: str, + app_name: str, + domain_name: str, + domain_resource: "_models.CustomDomainResource", + **kwargs: Any + ) -> "_models.CustomDomainResource": """Create or update custom domain of one lifecycle application. :param resource_group_name: The name of the resource group that contains the resource. You can @@ -146,34 +398,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,17 +429,19 @@ 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 - service_name, # type: str - app_name, # type: str - domain_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + resource_group_name: str, + service_name: str, + app_name: str, + domain_name: str, + **kwargs: Any + ) -> None: """Delete the custom domain of one lifecycle application. :param resource_group_name: The name of the resource group that contains the resource. You can @@ -219,29 +463,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,16 +488,17 @@ 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 - service_name, # type: str - app_name, # type: str - domain_name, # type: str - domain_resource, # type: "_models.CustomDomainResource" - **kwargs # type: Any - ): - # type: (...) -> "_models.CustomDomainResource" + resource_group_name: str, + service_name: str, + app_name: str, + domain_name: str, + domain_resource: "_models.CustomDomainResource", + **kwargs: Any + ) -> "_models.CustomDomainResource": """Update custom domain of one lifecycle application. :param resource_group_name: The name of the resource group that contains the resource. You can @@ -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] - # 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_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,16 +553,18 @@ 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 - service_name, # type: str - app_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.CustomDomainResourceCollection"] + resource_group_name: str, + service_name: str, + app_name: str, + **kwargs: Any + ) -> 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 @@ -348,8 +575,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 +586,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,20 +632,21 @@ 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 - service_name, # type: str - app_name, # type: str - validate_payload, # type: "_models.CustomDomainValidatePayload" - **kwargs # type: Any - ): - # type: (...) -> "_models.CustomDomainValidateResult" + 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 @@ -429,7 +657,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 +669,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 +699,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 17e1d62979ba..9a790da5236e 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,25 +5,438 @@ # 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 +import functools +from typing import Any, Callable, Dict, Generic, Iterable, List, Optional, TypeVar, Union 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 - -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]] +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +JSONType = Any +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_get_request( + subscription_id: str, + resource_group_name: str, + service_name: str, + app_name: str, + deployment_name: str, + **kwargs: Any +) -> 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: str, + resource_group_name: str, + service_name: str, + app_name: str, + deployment_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> 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, + json=json, + content=content, + **kwargs + ) + + +def build_delete_request( + subscription_id: str, + resource_group_name: str, + service_name: str, + app_name: str, + deployment_name: str, + **kwargs: Any +) -> 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: str, + resource_group_name: str, + service_name: str, + app_name: str, + deployment_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> 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, + json=json, + content=content, + **kwargs + ) + + +def build_list_request( + subscription_id: str, + resource_group_name: str, + service_name: str, + app_name: str, + *, + version: Optional[List[str]] = None, + **kwargs: Any +) -> 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') + 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: str, + resource_group_name: str, + service_name: str, + *, + version: Optional[List[str]] = None, + **kwargs: Any +) -> 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}/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: str, + resource_group_name: str, + service_name: str, + app_name: str, + deployment_name: str, + **kwargs: Any +) -> 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: str, + resource_group_name: str, + service_name: str, + app_name: str, + deployment_name: str, + **kwargs: Any +) -> 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: str, + resource_group_name: str, + service_name: str, + app_name: str, + deployment_name: str, + **kwargs: Any +) -> 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: str, + resource_group_name: str, + service_name: str, + app_name: str, + deployment_name: str, + **kwargs: Any +) -> 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 + ) class DeploymentsOperations(object): """DeploymentsOperations operations. @@ -47,15 +460,15 @@ def __init__(self, client, config, serializer, deserializer): 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" + 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 @@ -77,29 +490,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,51 +516,42 @@ 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 - service_name, # type: str - app_name, # type: str - deployment_name, # type: str - deployment_resource, # type: "_models.DeploymentResource" - **kwargs # type: Any - ): - # type: (...) -> "_models.DeploymentResource" + resource_group_name: str, + service_name: str, + app_name: str, + deployment_name: str, + deployment_resource: "_models.DeploymentResource", + **kwargs: Any + ) -> "_models.DeploymentResource": cls = kwargs.pop('cls', None) # type: ClsType["_models.DeploymentResource"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-05-01-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._create_or_update_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - 'appName': self._serialize.url("app_name", app_name, 'str'), - 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(deployment_resource, 'DeploymentResource') - # 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, + 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,18 +572,20 @@ 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 - service_name, # type: str - app_name, # type: str - deployment_name, # type: str - deployment_resource, # type: "_models.DeploymentResource" - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.DeploymentResource"] + resource_group_name: str, + service_name: str, + app_name: str, + deployment_name: str, + deployment_resource: "_models.DeploymentResource", + **kwargs: Any + ) -> 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 @@ -202,18 +598,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 +629,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,17 +655,18 @@ 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 - service_name, # type: str - app_name, # type: str - deployment_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + resource_group_name: str, + service_name: str, + app_name: str, + deployment_name: str, + **kwargs: Any + ) -> None: """Operation to delete a Deployment. :param resource_group_name: The name of the resource group that contains the resource. You can @@ -293,29 +688,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,49 +713,39 @@ 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 - service_name, # type: str - app_name, # type: str - deployment_name, # type: str - deployment_resource, # type: "_models.DeploymentResource" - **kwargs # type: Any - ): - # type: (...) -> "_models.DeploymentResource" + resource_group_name: str, + service_name: str, + app_name: str, + deployment_name: str, + deployment_resource: "_models.DeploymentResource", + **kwargs: Any + ) -> "_models.DeploymentResource": cls = kwargs.pop('cls', None) # type: ClsType["_models.DeploymentResource"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-05-01-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._update_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - 'appName': self._serialize.url("app_name", app_name, 'str'), - 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + 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,18 +763,20 @@ 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 - service_name, # type: str - app_name, # type: str - deployment_name, # type: str - deployment_resource, # type: "_models.DeploymentResource" - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.DeploymentResource"] + resource_group_name: str, + service_name: str, + app_name: str, + deployment_name: str, + deployment_resource: "_models.DeploymentResource", + **kwargs: Any + ) -> 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 @@ -412,18 +789,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 +820,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,17 +846,18 @@ 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 - service_name, # type: str - app_name, # type: str - version=None, # type: Optional[List[str]] - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.DeploymentResourceCollection"] + resource_group_name: str, + service_name: str, + app_name: str, + version: Optional[List[str]] = None, + **kwargs: Any + ) -> 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 @@ -494,8 +870,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 +881,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,19 +929,20 @@ 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 - service_name, # type: str - version=None, # type: Optional[List[str]] - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.DeploymentResourceCollection"] + resource_group_name: str, + service_name: str, + version: Optional[List[str]] = None, + **kwargs: Any + ) -> 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 @@ -576,8 +953,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 +964,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 +1010,7 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) @@ -641,41 +1018,30 @@ def get_next(next_link=None): 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 + resource_group_name: str, + service_name: str, + app_name: str, + deployment_name: str, + **kwargs: Any + ) -> None: cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-05-01-preview" - accept = "application/json" - - # Construct URL - url = self._start_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - 'appName': self._serialize.url("app_name", app_name, 'str'), - 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = 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,15 +1054,16 @@ 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 - service_name, # type: str - app_name, # type: str - deployment_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> LROPoller[None] + resource_group_name: str, + service_name: str, + app_name: str, + deployment_name: str, + **kwargs: Any + ) -> LROPoller[None]: """Start the deployment. :param resource_group_name: The name of the resource group that contains the resource. You can @@ -710,15 +1077,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 +1103,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,45 +1122,35 @@ 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( self, - resource_group_name, # type: str - service_name, # type: str - app_name, # type: str - deployment_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + resource_group_name: str, + service_name: str, + app_name: str, + deployment_name: str, + **kwargs: Any + ) -> None: cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-05-01-preview" - accept = "application/json" - - # Construct URL - url = self._stop_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - 'appName': self._serialize.url("app_name", app_name, 'str'), - 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = 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,15 +1163,16 @@ 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 - service_name, # type: str - app_name, # type: str - deployment_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> LROPoller[None] + resource_group_name: str, + service_name: str, + app_name: str, + deployment_name: str, + **kwargs: Any + ) -> LROPoller[None]: """Stop the deployment. :param resource_group_name: The name of the resource group that contains the resource. You can @@ -835,15 +1186,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 +1212,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,45 +1231,35 @@ 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( self, - resource_group_name, # type: str - service_name, # type: str - app_name, # type: str - deployment_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + resource_group_name: str, + service_name: str, + app_name: str, + deployment_name: str, + **kwargs: Any + ) -> None: cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-05-01-preview" - accept = "application/json" - - # Construct URL - url = self._restart_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - 'appName': self._serialize.url("app_name", app_name, 'str'), - 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = 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,15 +1272,16 @@ 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 - service_name, # type: str - app_name, # type: str - deployment_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> LROPoller[None] + resource_group_name: str, + service_name: str, + app_name: str, + deployment_name: str, + **kwargs: Any + ) -> LROPoller[None]: """Restart the deployment. :param resource_group_name: The name of the resource group that contains the resource. You can @@ -960,15 +1295,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 +1321,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,17 +1340,18 @@ 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 - service_name, # type: str - app_name, # type: str - deployment_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> Optional["_models.LogFileUrlResponse"] + 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 @@ -1044,29 +1373,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 +1401,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 ec98a8ef76a4..da8e32de5893 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,23 +5,50 @@ # 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 +import functools +from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar 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 - -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]] +from .._vendor import _convert_request +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_list_request( + **kwargs: Any +) -> 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 + ) class Operations(object): """Operations operations. @@ -45,16 +72,17 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def list( self, - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.AvailableOperations"] + **kwargs: Any + ) -> Iterable["_models.AvailableOperations"]: """Lists all of the available REST API operations of the Microsoft.AppPlatform provider. :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either AvailableOperations or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2019_05_01_preview.models.AvailableOperations] + :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 +90,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 +128,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 d050faed2388..9a80f44cf4e1 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,22 +5,49 @@ # 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 +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 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 - -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]] +from .._vendor import _convert_request +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_list_runtime_versions_request( + **kwargs: Any +) -> 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 + ) class RuntimeVersionsOperations(object): """RuntimeVersionsOperations operations. @@ -44,11 +71,11 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def list_runtime_versions( self, - **kwargs # type: Any - ): - # type: (...) -> "_models.AvailableRuntimeVersions" + **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 @@ -61,21 +88,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') + + 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) - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -89,4 +109,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 8908a38ac8da..4e4eadbaaebc 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,25 +5,441 @@ # 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 +import functools +from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union 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 - -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]] +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +JSONType = Any +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_get_request( + subscription_id: str, + resource_group_name: str, + service_name: str, + **kwargs: Any +) -> 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: str, + resource_group_name: str, + service_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> 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, + json=json, + content=content, + **kwargs + ) + + +def build_delete_request_initial( + subscription_id: str, + resource_group_name: str, + service_name: str, + **kwargs: Any +) -> 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: str, + resource_group_name: str, + service_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> 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, + json=json, + content=content, + **kwargs + ) + + +def build_list_test_keys_request( + subscription_id: str, + resource_group_name: str, + service_name: str, + **kwargs: Any +) -> 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: str, + resource_group_name: str, + service_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> 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, + json=json, + content=content, + **kwargs + ) + + +def build_disable_test_endpoint_request( + subscription_id: str, + resource_group_name: str, + service_name: str, + **kwargs: Any +) -> 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: str, + resource_group_name: str, + service_name: str, + **kwargs: Any +) -> 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: str, + location: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> 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, + json=json, + content=content, + **kwargs + ) + + +def build_list_by_subscription_request( + subscription_id: str, + **kwargs: Any +) -> 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: str, + resource_group_name: str, + **kwargs: Any +) -> 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 + ) class ServicesOperations(object): """ServicesOperations operations. @@ -47,13 +463,13 @@ def __init__(self, client, config, serializer, deserializer): 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" + 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 @@ -71,27 +487,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,47 +511,38 @@ 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 - service_name, # type: str - resource, # type: "_models.ServiceResource" - **kwargs # type: Any - ): - # type: (...) -> "_models.ServiceResource" + resource_group_name: str, + service_name: str, + resource: "_models.ServiceResource", + **kwargs: Any + ) -> "_models.ServiceResource": cls = kwargs.pop('cls', None) # type: ClsType["_models.ServiceResource"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-05-01-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._create_or_update_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(resource, 'ServiceResource') - # 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, + 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,16 +560,18 @@ 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 - service_name, # type: str - resource, # type: "_models.ServiceResource" - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.ServiceResource"] + resource_group_name: str, + service_name: str, + resource: "_models.ServiceResource", + **kwargs: Any + ) -> 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 @@ -184,15 +583,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 +608,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,41 +634,31 @@ 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( self, - resource_group_name, # type: str - service_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + resource_group_name: str, + service_name: str, + **kwargs: Any + ) -> None: cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-05-01-preview" - accept = "application/json" - - # Construct URL - url = self._delete_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = 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,13 +671,14 @@ 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 - service_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> LROPoller[None] + resource_group_name: str, + service_name: str, + **kwargs: Any + ) -> LROPoller[None]: """Operation to delete a Service. :param resource_group_name: The name of the resource group that contains the resource. You can @@ -299,15 +688,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 +712,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,47 +731,37 @@ 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( self, - resource_group_name, # type: str - service_name, # type: str - resource, # type: "_models.ServiceResource" - **kwargs # type: Any - ): - # type: (...) -> "_models.ServiceResource" + resource_group_name: str, + service_name: str, + resource: "_models.ServiceResource", + **kwargs: Any + ) -> "_models.ServiceResource": cls = kwargs.pop('cls', None) # type: ClsType["_models.ServiceResource"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-05-01-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._update_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + 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,16 +779,18 @@ 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 - service_name, # type: str - resource, # type: "_models.ServiceResource" - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.ServiceResource"] + resource_group_name: str, + service_name: str, + resource: "_models.ServiceResource", + **kwargs: Any + ) -> 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 @@ -426,15 +802,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 +827,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,15 +853,16 @@ 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 - service_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.TestKeys" + 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 @@ -504,27 +880,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,16 +904,18 @@ 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 - service_name, # type: str - regenerate_test_key_request, # type: "_models.RegenerateTestKeyRequestPayload" - **kwargs # type: Any - ): - # type: (...) -> "_models.TestKeys" + 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 @@ -556,7 +924,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 +936,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,15 +965,17 @@ 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 - service_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + resource_group_name: str, + service_name: str, + **kwargs: Any + ) -> None: """disable_test_endpoint. :param resource_group_name: The name of the resource group that contains the resource. You can @@ -632,27 +993,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,13 +1016,14 @@ 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 - service_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.TestKeys" + resource_group_name: str, + service_name: str, + **kwargs: Any + ) -> "_models.TestKeys": """enable_test_endpoint. :param resource_group_name: The name of the resource group that contains the resource. You can @@ -689,27 +1041,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,21 +1065,24 @@ 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 - availability_parameters, # type: "_models.NameAvailabilityParameters" - **kwargs # type: Any - ): - # type: (...) -> "_models.NameAvailability" + location: str, + availability_parameters: "_models.NameAvailabilityParameters", + **kwargs: Any + ) -> "_models.NameAvailability": """Checks that the resource name is valid and is not already in use. :param location: the region. :type location: str :param availability_parameters: Parameters supplied to the operation. - :type availability_parameters: ~azure.mgmt.appplatform.v2019_05_01_preview.models.NameAvailabilityParameters + :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 +1093,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,18 +1121,21 @@ 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 - ): - # type: (...) -> Iterable["_models.ServiceResourceList"] + **kwargs: Any + ) -> 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.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 +1143,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,17 +1183,18 @@ 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 - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.ServiceResourceList"] + resource_group_name: str, + **kwargs: Any + ) -> 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 @@ -868,7 +1202,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 +1211,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 +1253,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 092aacde06d7..e7b0492a9dc8 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,23 +5,56 @@ # 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 +import functools +from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar 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 - -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]] +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_list_request( + subscription_id: str, + **kwargs: Any +) -> 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 + ) class SkuOperations(object): """SkuOperations operations. @@ -45,16 +78,18 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def list( self, - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.ResourceSkuCollection"] + **kwargs: Any + ) -> Iterable["_models.ResourceSkuCollection"]: """list. :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either ResourceSkuCollection or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2019_05_01_preview.models.ResourceSkuCollection] + :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 +97,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 +137,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 d2ddf950056a..41ec6d71ff7f 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 bbb07fef27c2..9a517e590f4c 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,34 +6,22 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING +from copy import deepcopy +from typing import Any, Optional, TYPE_CHECKING +from azure.core.rest import HttpRequest, HttpResponse 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 - -class AppPlatformManagementClient(object): +class AppPlatformManagementClient: """REST API for Azure Spring Cloud. :ivar services: ServicesOperations operations @@ -41,7 +29,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 +44,73 @@ 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] - **kwargs # type: Any - ): - # type: (...) -> None - if not base_url: - base_url = 'https://management.azure.com' - self._config = AppPlatformManagementClientConfiguration(credential, subscription_id, **kwargs) + credential: "TokenCredential", + 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 = 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: Any + ) -> HttpResponse: """Runs the network request through the client's chained policies. - :param http_request: The network request you want to make. Required. - :type http_request: ~azure.core.pipeline.transport.HttpRequest - :keyword bool stream: Whether the response payload will be streamed. Defaults to True. + >>> 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 2e027c534593..8cbbcd5b4efc 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 @@ -6,18 +6,16 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING +from typing import Any, TYPE_CHECKING from azure.core.configuration import Configuration from azure.core.pipeline import policies -from azure.mgmt.core.policies import ARMHttpLoggingPolicy +from 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 @@ -35,16 +33,15 @@ class AppPlatformManagementClientConfiguration(Configuration): def __init__( self, - credential, # type: "TokenCredential" - subscription_id, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + credential: "TokenCredential", + 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 @@ -68,4 +65,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 1f417c7fc3fb..acc998545026 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 000000000000..74e48ecd07cf --- /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 000000000000..138f663c53a4 --- /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/aio/__init__.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2020_07_01/aio/__init__.py index 39f105488735..44ce4a5043f8 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 497d1a0e0b05..df2038c8e41c 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 101a93f7aef9..85cc47a5a094 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 000000000000..74e48ecd07cf --- /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 96a7b447e45f..314df0b96a2c 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 732cfe5da5cd..9b35f296e63b 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 6407846b0e55..86afd95863ad 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 7e48efe0d068..04f807b6fe46 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 46bb8daccbcc..4a4bfe10b034 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 36566cc712b1..cacf29f88f81 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 4dc1442371f5..3093737012cc 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 d114e98657ea..6e1b9af660c6 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 1d3ccd3dbfe1..f15b543579b6 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 092b2ee09fc4..d110268bc872 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 c7de60e3a3f4..35e1d056c03d 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 5659fe3dbc3d..e4dbda7bd1b2 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 @@ -6,146 +6,78 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -try: - from ._models_py3 import AppResource - from ._models_py3 import AppResourceCollection - from ._models_py3 import AppResourceProperties - from ._models_py3 import AvailableOperations - from ._models_py3 import AvailableRuntimeVersions - from ._models_py3 import BindingResource - from ._models_py3 import BindingResourceCollection - from ._models_py3 import BindingResourceProperties - from ._models_py3 import CertificateProperties - from ._models_py3 import CertificateResource - from ._models_py3 import CertificateResourceCollection - from ._models_py3 import CloudErrorBody - from ._models_py3 import ClusterResourceProperties - from ._models_py3 import ConfigServerGitProperty - from ._models_py3 import ConfigServerProperties - from ._models_py3 import ConfigServerResource - from ._models_py3 import ConfigServerSettings - from ._models_py3 import ConfigServerSettingsErrorRecord - from ._models_py3 import ConfigServerSettingsValidateResult - from ._models_py3 import CustomDomainProperties - from ._models_py3 import CustomDomainResource - from ._models_py3 import CustomDomainResourceCollection - from ._models_py3 import CustomDomainValidatePayload - from ._models_py3 import CustomDomainValidateResult - from ._models_py3 import DeploymentInstance - from ._models_py3 import DeploymentResource - from ._models_py3 import DeploymentResourceCollection - from ._models_py3 import DeploymentResourceProperties - from ._models_py3 import DeploymentSettings - from ._models_py3 import Error - from ._models_py3 import GitPatternRepository - 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 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 SupportedRuntimeVersion - 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 AvailableOperations # type: ignore - from ._models import AvailableRuntimeVersions # type: ignore - from ._models import BindingResource # type: ignore - from ._models import BindingResourceCollection # type: ignore - from ._models import BindingResourceProperties # type: ignore - from ._models import CertificateProperties # type: ignore - from ._models import CertificateResource # type: ignore - from ._models import CertificateResourceCollection # type: ignore - from ._models import CloudErrorBody # type: ignore - from ._models import ClusterResourceProperties # type: ignore - from ._models import ConfigServerGitProperty # type: ignore - from ._models import ConfigServerProperties # type: ignore - from ._models import ConfigServerResource # type: ignore - from ._models import ConfigServerSettings # type: ignore - from ._models import ConfigServerSettingsErrorRecord # type: ignore - from ._models import ConfigServerSettingsValidateResult # type: ignore - from ._models import CustomDomainProperties # type: ignore - from ._models import CustomDomainResource # type: ignore - from ._models import CustomDomainResourceCollection # type: ignore - from ._models import CustomDomainValidatePayload # type: ignore - from ._models import CustomDomainValidateResult # type: ignore - from ._models import DeploymentInstance # type: ignore - from ._models import DeploymentResource # type: ignore - from ._models import DeploymentResourceCollection # type: ignore - from ._models import DeploymentResourceProperties # type: ignore - from ._models import DeploymentSettings # type: ignore - from ._models import Error # type: ignore - from ._models import GitPatternRepository # type: ignore - from ._models import LogFileUrlResponse # type: ignore - from ._models import LogSpecification # type: ignore - from ._models import ManagedIdentityProperties # type: ignore - from ._models import MetricDimension # type: ignore - from ._models import MetricSpecification # type: ignore - from ._models import MonitoringSettingProperties # type: ignore - from ._models import MonitoringSettingResource # type: ignore - from ._models import NameAvailability # type: ignore - from ._models import NameAvailabilityParameters # type: ignore - from ._models import NetworkProfile # type: ignore - from ._models import NetworkProfileOutboundIPs # type: ignore - from ._models import OperationDetail # type: ignore - from ._models import OperationDisplay # type: ignore - from ._models import OperationProperties # type: ignore - from ._models import PersistentDisk # type: ignore - from ._models import ProxyResource # type: ignore - from ._models import RegenerateTestKeyRequestPayload # type: ignore - from ._models import RequiredTraffic # type: ignore - from ._models import Resource # type: ignore - from ._models import ResourceSku # type: ignore - from ._models import ResourceSkuCapabilities # type: ignore - from ._models import ResourceSkuCollection # type: ignore - from ._models import ResourceSkuLocationInfo # type: ignore - from ._models import ResourceSkuRestrictionInfo # type: ignore - from ._models import ResourceSkuRestrictions # type: ignore - from ._models import ResourceSkuZoneDetails # type: ignore - from ._models import ResourceUploadDefinition # type: ignore - from ._models import ServiceResource # type: ignore - from ._models import ServiceResourceList # type: ignore - from ._models import ServiceSpecification # type: ignore - from ._models import Sku # type: ignore - from ._models import SkuCapacity # type: ignore - from ._models import SupportedRuntimeVersion # type: ignore - from ._models import TemporaryDisk # type: ignore - from ._models import TestKeys # type: ignore - from ._models import TrackedResource # type: ignore - from ._models import UserSourceInfo # type: ignore +from ._models_py3 import AppResource +from ._models_py3 import AppResourceCollection +from ._models_py3 import AppResourceProperties +from ._models_py3 import AvailableOperations +from ._models_py3 import AvailableRuntimeVersions +from ._models_py3 import BindingResource +from ._models_py3 import BindingResourceCollection +from ._models_py3 import BindingResourceProperties +from ._models_py3 import CertificateProperties +from ._models_py3 import CertificateResource +from ._models_py3 import CertificateResourceCollection +from ._models_py3 import CloudErrorBody +from ._models_py3 import ClusterResourceProperties +from ._models_py3 import ConfigServerGitProperty +from ._models_py3 import ConfigServerProperties +from ._models_py3 import ConfigServerResource +from ._models_py3 import ConfigServerSettings +from ._models_py3 import ConfigServerSettingsErrorRecord +from ._models_py3 import ConfigServerSettingsValidateResult +from ._models_py3 import CustomDomainProperties +from ._models_py3 import CustomDomainResource +from ._models_py3 import CustomDomainResourceCollection +from ._models_py3 import CustomDomainValidatePayload +from ._models_py3 import CustomDomainValidateResult +from ._models_py3 import DeploymentInstance +from ._models_py3 import DeploymentResource +from ._models_py3 import DeploymentResourceCollection +from ._models_py3 import DeploymentResourceProperties +from ._models_py3 import DeploymentSettings +from ._models_py3 import Error +from ._models_py3 import GitPatternRepository +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 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 SupportedRuntimeVersion +from ._models_py3 import TemporaryDisk +from ._models_py3 import TestKeys +from ._models_py3 import TrackedResource +from ._models_py3 import UserSourceInfo + from ._app_platform_management_client_enums import ( + ActionType, AppResourceProvisioningState, ConfigServerState, DeploymentResourceProvisioningState, @@ -233,6 +165,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 5ac8dede62c0..483260921151 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 deleted file mode 100644 index 10db354c88fe..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2020_07_01/models/_models.py +++ /dev/null @@ -1,2340 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -import msrest.serialization - - -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 - :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 - """ - - _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 - ): - 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. - - :param value: Collection of App resources. - :type value: list[~azure.mgmt.appplatform.v2020_07_01.models.AppResource] - :param next_link: URL client should use to fetch the next page (per server side paging). - It's null for now, added for future use. - :type next_link: str - """ - - _attribute_map = { - 'value': {'key': 'value', 'type': '[AppResource]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(AppResourceCollection, self).__init__(**kwargs) - self.value = kwargs.get('value', None) - self.next_link = kwargs.get('next_link', None) - - -class AppResourceProperties(msrest.serialization.Model): - """App resource properties payload. - - Variables are only populated by the server, and will be ignored when sending a request. - - :param public: Indicates whether the App exposes public endpoint. - :type 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 created_time: Date time when the resource is created. - :vartype created_time: ~datetime.datetime - :param temporary_disk: Temporary disk settings. - :type temporary_disk: ~azure.mgmt.appplatform.v2020_07_01.models.TemporaryDisk - :param persistent_disk: Persistent disk settings. - :type persistent_disk: ~azure.mgmt.appplatform.v2020_07_01.models.PersistentDisk - """ - - _validation = { - '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'}, - } - - def __init__( - self, - **kwargs - ): - super(AppResourceProperties, self).__init__(**kwargs) - self.public = kwargs.get('public', None) - self.url = None - self.provisioning_state = None - self.active_deployment_name = kwargs.get('active_deployment_name', None) - self.fqdn = kwargs.get('fqdn', None) - self.https_only = kwargs.get('https_only', False) - self.created_time = None - self.temporary_disk = kwargs.get('temporary_disk', None) - self.persistent_disk = kwargs.get('persistent_disk', None) - - -class AvailableOperations(msrest.serialization.Model): - """Available operations of the service. - - :param value: Collection of available operation details. - :type value: list[~azure.mgmt.appplatform.v2020_07_01.models.OperationDetail] - :param next_link: URL client should use to fetch the next page (per server side paging). - It's null for now, added for future use. - :type next_link: str - """ - - _attribute_map = { - 'value': {'key': 'value', 'type': '[OperationDetail]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(AvailableOperations, self).__init__(**kwargs) - self.value = kwargs.get('value', None) - self.next_link = kwargs.get('next_link', None) - - -class AvailableRuntimeVersions(msrest.serialization.Model): - """AvailableRuntimeVersions. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar value: A list of all supported runtime versions. - :vartype value: list[~azure.mgmt.appplatform.v2020_07_01.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 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 - :param properties: Properties of the Binding resource. - :type properties: ~azure.mgmt.appplatform.v2020_07_01.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 - ): - 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. - - :param value: Collection of Binding resources. - :type value: list[~azure.mgmt.appplatform.v2020_07_01.models.BindingResource] - :param next_link: URL client should use to fetch the next page (per server side paging). - It's null for now, added for future use. - :type next_link: str - """ - - _attribute_map = { - 'value': {'key': 'value', 'type': '[BindingResource]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(BindingResourceCollection, self).__init__(**kwargs) - self.value = kwargs.get('value', None) - self.next_link = kwargs.get('next_link', None) - - -class BindingResourceProperties(msrest.serialization.Model): - """Binding resource properties payload. - - Variables are only populated by the server, and will be ignored when sending a request. - - :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 - :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 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 - ): - 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. - - 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 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 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 = { - 'thumbprint': {'readonly': True}, - 'vault_uri': {'required': True}, - 'key_vault_cert_name': {'required': 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 = { - 'thumbprint': {'key': 'thumbprint', 'type': 'str'}, - 'vault_uri': {'key': 'vaultUri', 'type': 'str'}, - 'key_vault_cert_name': {'key': 'keyVaultCertName', 'type': 'str'}, - 'cert_version': {'key': 'certVersion', '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]'}, - } - - def __init__( - self, - **kwargs - ): - super(CertificateProperties, self).__init__(**kwargs) - self.thumbprint = None - self.vault_uri = kwargs['vault_uri'] - self.key_vault_cert_name = kwargs['key_vault_cert_name'] - self.cert_version = kwargs.get('cert_version', None) - self.issuer = None - self.issued_date = None - 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 - :param properties: Properties of the certificate resource payload. - :type properties: ~azure.mgmt.appplatform.v2020_07_01.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 - ): - 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. - - :param value: The certificate resources list. - :type value: list[~azure.mgmt.appplatform.v2020_07_01.models.CertificateResource] - :param next_link: The link to next page of certificate list. - :type next_link: str - """ - - _attribute_map = { - 'value': {'key': 'value', 'type': '[CertificateResource]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(CertificateResourceCollection, self).__init__(**kwargs) - self.value = kwargs.get('value', None) - self.next_link = kwargs.get('next_link', None) - - -class CloudErrorBody(msrest.serialization.Model): - """An error response from the service. - - :param code: An identifier for the error. Codes are invariant and are intended to be consumed - programmatically. - :type code: str - :param message: A message describing the error, intended to be suitable for display in a user - interface. - :type message: str - :param target: The target of the particular error. For example, the name of the property in - error. - :type target: str - :param details: A list of additional details about the error. - :type details: list[~azure.mgmt.appplatform.v2020_07_01.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 - ): - 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.v2020_07_01.models.ProvisioningState - :param network_profile: Network profile of the Service. - :type network_profile: ~azure.mgmt.appplatform.v2020_07_01.models.NetworkProfile - :ivar version: Version of the Service. - :vartype version: int - :ivar service_id: ServiceInstanceEntity GUID which uniquely identifies a created resource. - :vartype service_id: str - """ - - _validation = { - 'provisioning_state': {'readonly': True}, - 'version': {'readonly': True}, - 'service_id': {'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'}, - } - - def __init__( - self, - **kwargs - ): - super(ClusterResourceProperties, self).__init__(**kwargs) - self.provisioning_state = None - self.network_profile = kwargs.get('network_profile', None) - self.version = None - self.service_id = None - - -class ConfigServerGitProperty(msrest.serialization.Model): - """Property of git. - - All required parameters must be populated in order to send to Azure. - - :param repositories: Repositories of git. - :type repositories: list[~azure.mgmt.appplatform.v2020_07_01.models.GitPatternRepository] - :param uri: Required. URI of the repository. - :type 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 - """ - - _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 - ): - 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.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 - """ - - _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 - ): - 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 - :param properties: Properties of the Config Server resource. - :type properties: ~azure.mgmt.appplatform.v2020_07_01.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 - ): - super(ConfigServerResource, self).__init__(**kwargs) - self.properties = kwargs.get('properties', None) - - -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 - """ - - _attribute_map = { - 'git_property': {'key': 'gitProperty', 'type': 'ConfigServerGitProperty'}, - } - - def __init__( - self, - **kwargs - ): - 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. - - :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] - """ - - _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'uri': {'key': 'uri', 'type': 'str'}, - 'messages': {'key': 'messages', 'type': '[str]'}, - } - - def __init__( - self, - **kwargs - ): - super(ConfigServerSettingsErrorRecord, self).__init__(**kwargs) - self.name = kwargs.get('name', None) - self.uri = kwargs.get('uri', None) - self.messages = kwargs.get('messages', None) - - -class ConfigServerSettingsValidateResult(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] - """ - - _attribute_map = { - 'is_valid': {'key': 'isValid', 'type': 'bool'}, - 'details': {'key': 'details', 'type': '[ConfigServerSettingsErrorRecord]'}, - } - - def __init__( - self, - **kwargs - ): - super(ConfigServerSettingsValidateResult, self).__init__(**kwargs) - self.is_valid = kwargs.get('is_valid', None) - self.details = kwargs.get('details', None) - - -class CustomDomainProperties(msrest.serialization.Model): - """Custom domain of app resource payload. - - 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 app_name: The app name of domain. - :vartype app_name: str - :param cert_name: The bound certificate name of domain. - :type 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 - ): - 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 - :param properties: Properties of the custom domain resource. - :type properties: ~azure.mgmt.appplatform.v2020_07_01.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 - ): - 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. - - :param value: The custom domain resources list. - :type value: list[~azure.mgmt.appplatform.v2020_07_01.models.CustomDomainResource] - :param next_link: The link to next page of custom domain list. - :type next_link: str - """ - - _attribute_map = { - 'value': {'key': 'value', 'type': '[CustomDomainResource]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(CustomDomainResourceCollection, self).__init__(**kwargs) - self.value = kwargs.get('value', None) - self.next_link = kwargs.get('next_link', None) - - -class CustomDomainValidatePayload(msrest.serialization.Model): - """Custom domain validate payload. - - All required parameters must be populated in order to send to Azure. - - :param name: Required. Name to be validated. - :type name: str - """ - - _validation = { - 'name': {'required': True}, - } - - _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(CustomDomainValidatePayload, self).__init__(**kwargs) - self.name = kwargs['name'] - - -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 - """ - - _attribute_map = { - 'is_valid': {'key': 'isValid', 'type': 'bool'}, - 'message': {'key': 'message', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(CustomDomainValidateResult, self).__init__(**kwargs) - self.is_valid = kwargs.get('is_valid', None) - self.message = kwargs.get('message', None) - - -class DeploymentInstance(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 - :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 - """ - - _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 - ): - 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. - - :param value: Collection of Deployment resources. - :type value: list[~azure.mgmt.appplatform.v2020_07_01.models.DeploymentResource] - :param next_link: URL client should use to fetch the next page (per server side paging). - It's null for now, added for future use. - :type next_link: str - """ - - _attribute_map = { - 'value': {'key': 'value', 'type': '[DeploymentResource]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(DeploymentResourceCollection, self).__init__(**kwargs) - self.value = kwargs.get('value', None) - self.next_link = kwargs.get('next_link', None) - - -class DeploymentResourceProperties(msrest.serialization.Model): - """Deployment resource properties payload. - - Variables are only populated by the server, and will be ignored when sending a request. - - :param source: Uploaded source information of the deployment. - :type source: ~azure.mgmt.appplatform.v2020_07_01.models.UserSourceInfo - :ivar app_name: App name of the deployment. - :vartype app_name: str - :param deployment_settings: Deployment settings of the Deployment. - :type deployment_settings: ~azure.mgmt.appplatform.v2020_07_01.models.DeploymentSettings - :ivar provisioning_state: Provisioning state of the Deployment. Possible values include: - "Creating", "Updating", "Succeeded", "Failed". - :vartype provisioning_state: str or - ~azure.mgmt.appplatform.v2020_07_01.models.DeploymentResourceProvisioningState - :ivar status: Status of the Deployment. Possible values include: "Unknown", "Stopped", - "Running", "Failed", "Allocating", "Upgrading", "Compiling". - :vartype status: str or ~azure.mgmt.appplatform.v2020_07_01.models.DeploymentResourceStatus - :ivar active: Indicates whether the Deployment is active. - :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.v2020_07_01.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 - ): - 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. - - :param cpu: Required CPU, basic tier should be 1, standard tier should be in range (1, 4). - :type cpu: int - :param memory_in_gb: Required Memory size in GB, basic tier should be in range (1, 2), standard - tier should be in range (1, 8). - :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", - "NetCore_31". Default value: "Java_8". - :type runtime_version: str or ~azure.mgmt.appplatform.v2020_07_01.models.RuntimeVersion - """ - - _attribute_map = { - 'cpu': {'key': 'cpu', 'type': 'int'}, - 'memory_in_gb': {'key': 'memoryInGB', 'type': 'int'}, - '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'}, - } - - def __init__( - self, - **kwargs - ): - super(DeploymentSettings, self).__init__(**kwargs) - self.cpu = kwargs.get('cpu', 1) - self.memory_in_gb = kwargs.get('memory_in_gb', 1) - self.jvm_options = kwargs.get('jvm_options', None) - self.net_core_main_entry_path = kwargs.get('net_core_main_entry_path', None) - self.environment_variables = kwargs.get('environment_variables', None) - self.runtime_version = kwargs.get('runtime_version', "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 - """ - - _attribute_map = { - 'code': {'key': 'code', 'type': 'str'}, - 'message': {'key': 'message', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - 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. - - :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 - """ - - _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 - ): - 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 LogFileUrlResponse(msrest.serialization.Model): - """Log file URL payload. - - All required parameters must be populated in order to send to Azure. - - :param url: Required. URL of the log file. - :type url: str - """ - - _validation = { - 'url': {'required': True}, - } - - _attribute_map = { - 'url': {'key': 'url', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(LogFileUrlResponse, self).__init__(**kwargs) - self.url = kwargs['url'] - - -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 - """ - - _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'display_name': {'key': 'displayName', 'type': 'str'}, - 'blob_duration': {'key': 'blobDuration', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(LogSpecification, self).__init__(**kwargs) - self.name = kwargs.get('name', None) - self.display_name = kwargs.get('display_name', None) - self.blob_duration = kwargs.get('blob_duration', None) - - -class ManagedIdentityProperties(msrest.serialization.Model): - """Managed identity properties retrieved from ARM request headers. - - :param type: Type of the managed identity. Possible values include: "None", "SystemAssigned", - "UserAssigned", "SystemAssigned,UserAssigned". - :type type: str or ~azure.mgmt.appplatform.v2020_07_01.models.ManagedIdentityType - :param principal_id: Principal Id. - :type principal_id: str - :param tenant_id: Tenant Id. - :type 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 - ): - 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. - - :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 - export scenario. - :type to_be_exported_for_shoebox: bool - """ - - _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'display_name': {'key': 'displayName', 'type': 'str'}, - 'to_be_exported_for_shoebox': {'key': 'toBeExportedForShoebox', 'type': 'bool'}, - } - - def __init__( - self, - **kwargs - ): - 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. - - :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 - belong to a single category. - :type category: str - :param aggregation_type: Only provide one value for this field. Valid values: Average, Minimum, - Maximum, Total, Count. - :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 - 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] - """ - - _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]'}, - } - - def __init__( - self, - **kwargs - ): - 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) - - -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.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 - """ - - _validation = { - 'provisioning_state': {'readonly': True}, - } - - _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'}, - } - - def __init__( - self, - **kwargs - ): - 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) - - -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 - :param properties: Properties of the Monitoring Setting resource. - :type properties: ~azure.mgmt.appplatform.v2020_07_01.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 - ): - super(MonitoringSettingResource, self).__init__(**kwargs) - self.properties = kwargs.get('properties', 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 - """ - - _attribute_map = { - 'name_available': {'key': 'nameAvailable', 'type': 'bool'}, - 'reason': {'key': 'reason', 'type': 'str'}, - 'message': {'key': 'message', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(NameAvailability, self).__init__(**kwargs) - self.name_available = kwargs.get('name_available', None) - self.reason = kwargs.get('reason', None) - self.message = kwargs.get('message', None) - - -class NameAvailabilityParameters(msrest.serialization.Model): - """Name availability parameters payload. - - All required parameters must be populated in order to send to Azure. - - :param type: Required. Type of the resource to check name availability. - :type type: str - :param name: Required. Name to be checked. - :type 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 - ): - 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. - - :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 - resources of Azure Spring Cloud Service Runtime. - :type service_runtime_network_resource_group: str - :param app_network_resource_group: Name of the resource group containing network resources of - Azure Spring Cloud Apps. - :type 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. - :vartype required_traffics: list[~azure.mgmt.appplatform.v2020_07_01.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 - ): - 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. - - :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 - """ - - _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'is_data_action': {'key': 'isDataAction', 'type': 'bool'}, - 'display': {'key': 'display', 'type': 'OperationDisplay'}, - 'origin': {'key': 'origin', 'type': 'str'}, - 'properties': {'key': 'properties', 'type': 'OperationProperties'}, - } - - def __init__( - self, - **kwargs - ): - super(OperationDetail, self).__init__(**kwargs) - self.name = kwargs.get('name', None) - self.is_data_action = kwargs.get('is_data_action', None) - self.display = kwargs.get('display', None) - self.origin = kwargs.get('origin', None) - self.properties = kwargs.get('properties', None) - - -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 - """ - - _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 - ): - 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. - - :param service_specification: Service specifications of the operation. - :type service_specification: ~azure.mgmt.appplatform.v2020_07_01.models.ServiceSpecification - """ - - _attribute_map = { - 'service_specification': {'key': 'serviceSpecification', 'type': 'ServiceSpecification'}, - } - - def __init__( - self, - **kwargs - ): - 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. - - :param size_in_gb: Size of the persistent disk in GB. - :type size_in_gb: int - :ivar used_in_gb: Size of the used persistent disk in GB. - :vartype used_in_gb: int - :param mount_path: Mount path of the persistent disk. - :type 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 - ): - 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. - - :param key_type: Required. Type of the test key. Possible values include: "Primary", - "Secondary". - :type key_type: str or ~azure.mgmt.appplatform.v2020_07_01.models.TestKeyType - """ - - _validation = { - 'key_type': {'required': True}, - } - - _attribute_map = { - 'key_type': {'key': 'keyType', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - 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.v2020_07_01.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 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 - the SKU is available. - :type location_info: list[~azure.mgmt.appplatform.v2020_07_01.models.ResourceSkuLocationInfo] - :param restrictions: Gets the restrictions because of which SKU cannot be used. This is - empty if there are no restrictions. - :type restrictions: list[~azure.mgmt.appplatform.v2020_07_01.models.ResourceSkuRestrictions] - """ - - _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 - ): - 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. - - :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 - """ - - _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'value': {'key': 'value', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - 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. - - :param value: Collection of resource SKU. - :type value: list[~azure.mgmt.appplatform.v2020_07_01.models.ResourceSku] - :param next_link: URL client should use to fetch the next page (per server side paging). - It's null for now, added for future use. - :type next_link: str - """ - - _attribute_map = { - 'value': {'key': 'value', 'type': '[ResourceSku]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(ResourceSkuCollection, self).__init__(**kwargs) - self.value = kwargs.get('value', None) - self.next_link = kwargs.get('next_link', None) - - -class ResourceSkuLocationInfo(msrest.serialization.Model): - """Locations and availability zones where the SKU is available. - - :param location: Gets location of the SKU. - :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] - """ - - _attribute_map = { - 'location': {'key': 'location', 'type': 'str'}, - 'zones': {'key': 'zones', 'type': '[str]'}, - 'zone_details': {'key': 'zoneDetails', 'type': '[ResourceSkuZoneDetails]'}, - } - - def __init__( - self, - **kwargs - ): - super(ResourceSkuLocationInfo, self).__init__(**kwargs) - self.location = kwargs.get('location', None) - self.zones = kwargs.get('zones', None) - self.zone_details = kwargs.get('zone_details', None) - - -class ResourceSkuRestrictionInfo(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] - """ - - _attribute_map = { - 'locations': {'key': 'locations', 'type': '[str]'}, - 'zones': {'key': 'zones', 'type': '[str]'}, - } - - def __init__( - self, - **kwargs - ): - 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. - - :param type: Gets the type of restrictions. Possible values include: 'Location', 'Zone'. - Possible values include: "Location", "Zone". - :type type: str or ~azure.mgmt.appplatform.v2020_07_01.models.ResourceSkuRestrictionsType - :param values: Gets the value of restrictions. If the restriction type is set to - location. This would be different locations where the SKU is restricted. - :type values: list[str] - :param restriction_info: Gets the information about the restriction where the SKU cannot be - used. - :type restriction_info: ~azure.mgmt.appplatform.v2020_07_01.models.ResourceSkuRestrictionInfo - :param reason_code: Gets the reason for restriction. Possible values include: 'QuotaId', - 'NotAvailableForSubscription'. Possible values include: "QuotaId", - "NotAvailableForSubscription". - :type reason_code: str or - ~azure.mgmt.appplatform.v2020_07_01.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 - ): - 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. - - :param name: Gets the set of zones that the SKU is available in with the - specified capabilities. - :type name: list[str] - :param capabilities: Gets a list of capabilities that are available for the SKU in the - specified list of zones. - :type capabilities: list[~azure.mgmt.appplatform.v2020_07_01.models.ResourceSkuCapabilities] - """ - - _attribute_map = { - 'name': {'key': 'name', 'type': '[str]'}, - 'capabilities': {'key': 'capabilities', 'type': '[ResourceSkuCapabilities]'}, - } - - def __init__( - self, - **kwargs - ): - 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. - - :param relative_path: Source relative path. - :type relative_path: str - :param upload_url: Upload URL. - :type upload_url: str - """ - - _attribute_map = { - 'relative_path': {'key': 'relativePath', 'type': 'str'}, - 'upload_url': {'key': 'uploadUrl', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(ResourceUploadDefinition, self).__init__(**kwargs) - self.relative_path = kwargs.get('relative_path', None) - self.upload_url = kwargs.get('upload_url', None) - - -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 - :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] - """ - - _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 - ): - 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 - :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 - """ - - _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 - ): - 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. - - :param value: Collection of Service resources. - :type value: list[~azure.mgmt.appplatform.v2020_07_01.models.ServiceResource] - :param next_link: URL client should use to fetch the next page (per server side paging). - It's null for now, added for future use. - :type next_link: str - """ - - _attribute_map = { - 'value': {'key': 'value', 'type': '[ServiceResource]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(ServiceResourceList, self).__init__(**kwargs) - self.value = kwargs.get('value', None) - self.next_link = kwargs.get('next_link', None) - - -class ServiceSpecification(msrest.serialization.Model): - """Service specification payload. - - :param log_specifications: Specifications of the Log for Azure Monitoring. - :type log_specifications: list[~azure.mgmt.appplatform.v2020_07_01.models.LogSpecification] - :param metric_specifications: Specifications of the Metrics for Azure Monitoring. - :type metric_specifications: - list[~azure.mgmt.appplatform.v2020_07_01.models.MetricSpecification] - """ - - _attribute_map = { - 'log_specifications': {'key': 'logSpecifications', 'type': '[LogSpecification]'}, - 'metric_specifications': {'key': 'metricSpecifications', 'type': '[MetricSpecification]'}, - } - - def __init__( - self, - **kwargs - ): - super(ServiceSpecification, self).__init__(**kwargs) - self.log_specifications = kwargs.get('log_specifications', None) - self.metric_specifications = kwargs.get('metric_specifications', None) - - -class Sku(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 - """ - - _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'tier': {'key': 'tier', 'type': 'str'}, - 'capacity': {'key': 'capacity', 'type': 'int'}, - } - - def __init__( - self, - **kwargs - ): - super(Sku, self).__init__(**kwargs) - self.name = kwargs.get('name', None) - self.tier = kwargs.get('tier', None) - self.capacity = kwargs.get('capacity', None) - - -class SkuCapacity(msrest.serialization.Model): - """The SKU capacity. - - 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", - "Manual", "Automatic". - :type scale_type: str or ~azure.mgmt.appplatform.v2020_07_01.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 - ): - 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 SupportedRuntimeVersion(msrest.serialization.Model): - """Supported deployment runtime version descriptor. - - :param value: The raw value which could be passed to deployment CRUD operations. Possible - values include: "Java_8", "Java_11", "NetCore_31". - :type value: str or ~azure.mgmt.appplatform.v2020_07_01.models.SupportedRuntimeValue - :param platform: The platform of this runtime version (possible values: "Java" or ".NET"). - Possible values include: "Java", ".NET Core". - :type platform: str or ~azure.mgmt.appplatform.v2020_07_01.models.SupportedRuntimePlatform - :param version: The detailed version (major.minor) of the platform. - :type version: str - """ - - _attribute_map = { - 'value': {'key': 'value', 'type': 'str'}, - 'platform': {'key': 'platform', 'type': 'str'}, - 'version': {'key': 'version', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(SupportedRuntimeVersion, self).__init__(**kwargs) - self.value = kwargs.get('value', None) - self.platform = kwargs.get('platform', None) - self.version = kwargs.get('version', None) - - -class TemporaryDisk(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 - """ - - _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 - ): - 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. - - :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 - """ - - _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 - ): - 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. - - :param type: Type of the source uploaded. Possible values include: "Jar", "NetCoreZip", - "Source". - :type type: str or ~azure.mgmt.appplatform.v2020_07_01.models.UserSourceType - :param relative_path: Relative path of the storage which stores the source. - :type relative_path: str - :param version: Version of the source. - :type version: str - :param artifact_selector: Selector for the artifact to be used for the deployment for - multi-module projects. This should be - the relative path to the target module/project. - :type artifact_selector: str - """ - - _attribute_map = { - 'type': {'key': 'type', 'type': 'str'}, - 'relative_path': {'key': 'relativePath', 'type': 'str'}, - 'version': {'key': 'version', 'type': 'str'}, - 'artifact_selector': {'key': 'artifactSelector', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(UserSourceInfo, self).__init__(**kwargs) - self.type = kwargs.get('type', None) - self.relative_path = kwargs.get('relative_path', None) - self.version = kwargs.get('version', None) - self.artifact_selector = kwargs.get('artifact_selector', None) 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 1d9493a94812..011dec21acc0 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 5be695c73640..11303f7114c2 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,25 +5,316 @@ # 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 +import functools +from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union 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 - -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]] +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +JSONType = Any +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_get_request( + subscription_id: str, + resource_group_name: str, + service_name: str, + app_name: str, + *, + sync_status: Optional[str] = None, + **kwargs: Any +) -> 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') + 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: str, + resource_group_name: str, + service_name: str, + app_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> 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, + json=json, + content=content, + **kwargs + ) + + +def build_delete_request_initial( + subscription_id: str, + resource_group_name: str, + service_name: str, + app_name: str, + **kwargs: Any +) -> 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: str, + resource_group_name: str, + service_name: str, + app_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> 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, + json=json, + content=content, + **kwargs + ) + + +def build_list_request( + subscription_id: str, + resource_group_name: str, + service_name: str, + **kwargs: Any +) -> 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: str, + resource_group_name: str, + service_name: str, + app_name: str, + **kwargs: Any +) -> 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: str, + resource_group_name: str, + service_name: str, + app_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> 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, + json=json, + content=content, + **kwargs + ) class AppsOperations(object): """AppsOperations operations. @@ -47,15 +338,15 @@ def __init__(self, client, config, serializer, deserializer): 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" + 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 @@ -77,30 +368,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,49 +394,40 @@ 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 - service_name, # type: str - app_name, # type: str - app_resource, # type: "_models.AppResource" - **kwargs # type: Any - ): - # type: (...) -> "_models.AppResource" + resource_group_name: str, + service_name: str, + app_name: str, + app_resource: "_models.AppResource", + **kwargs: Any + ) -> "_models.AppResource": cls = kwargs.pop('cls', None) # type: ClsType["_models.AppResource"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-07-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._create_or_update_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - 'appName': self._serialize.url("app_name", app_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + 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 @@ -177,17 +448,19 @@ 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 - service_name, # type: str - app_name, # type: str - app_resource, # type: "_models.AppResource" - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.AppResource"] + resource_group_name: str, + service_name: str, + app_name: str, + app_resource: "_models.AppResource", + **kwargs: Any + ) -> 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 @@ -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,43 +525,33 @@ 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( self, - resource_group_name, # type: str - service_name, # type: str - app_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + resource_group_name: str, + service_name: str, + app_name: str, + **kwargs: Any + ) -> None: cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-07-01" - accept = "application/json" - - # Construct URL - url = self._delete_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - 'appName': self._serialize.url("app_name", app_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = 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,14 +564,15 @@ 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 - service_name, # type: str - app_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> LROPoller[None] + resource_group_name: str, + service_name: str, + app_name: str, + **kwargs: Any + ) -> LROPoller[None]: """Operation to delete an App. :param resource_group_name: The name of the resource group that contains the resource. You can @@ -323,15 +584,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 +609,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,49 +628,39 @@ 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( 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" + resource_group_name: str, + service_name: str, + app_name: str, + app_resource: "_models.AppResource", + **kwargs: Any + ) -> "_models.AppResource": cls = kwargs.pop('cls', None) # type: ClsType["_models.AppResource"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-07-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._update_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - 'appName': self._serialize.url("app_name", app_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + 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,17 +678,19 @@ 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 - service_name, # type: str - app_name, # type: str - app_resource, # type: "_models.AppResource" - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.AppResource"] + resource_group_name: str, + service_name: str, + app_name: str, + app_resource: "_models.AppResource", + **kwargs: Any + ) -> 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 @@ -457,15 +704,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 +729,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,15 +755,16 @@ 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 - service_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.AppResourceCollection"] + resource_group_name: str, + service_name: str, + **kwargs: Any + ) -> 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 @@ -528,8 +773,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 +784,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,19 +828,20 @@ 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 - service_name, # type: str - app_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.ResourceUploadDefinition" + 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 @@ -616,28 +861,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,17 +886,19 @@ 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 - service_name, # type: str - app_name, # type: str - validate_payload, # type: "_models.CustomDomainValidatePayload" - **kwargs # type: Any - ): - # type: (...) -> "_models.CustomDomainValidateResult" + 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 @@ -683,33 +920,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 +950,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 4d01d1bab129..b8c0dc02c30f 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,25 +5,239 @@ # 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 +import functools +from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union 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 - -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]] +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +JSONType = Any +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_get_request( + subscription_id: str, + resource_group_name: str, + service_name: str, + app_name: str, + binding_name: str, + **kwargs: Any +) -> 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: str, + resource_group_name: str, + service_name: str, + app_name: str, + binding_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> 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, + json=json, + content=content, + **kwargs + ) + + +def build_delete_request_initial( + subscription_id: str, + resource_group_name: str, + service_name: str, + app_name: str, + binding_name: str, + **kwargs: Any +) -> 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: str, + resource_group_name: str, + service_name: str, + app_name: str, + binding_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> 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, + json=json, + content=content, + **kwargs + ) + + +def build_list_request( + subscription_id: str, + resource_group_name: str, + service_name: str, + app_name: str, + **kwargs: Any +) -> 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 + ) class BindingsOperations(object): """BindingsOperations operations. @@ -47,15 +261,15 @@ def __init__(self, client, config, serializer, deserializer): 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" + 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 @@ -77,29 +291,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,51 +317,42 @@ 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 - service_name, # type: str - app_name, # type: str - binding_name, # type: str - binding_resource, # type: "_models.BindingResource" - **kwargs # type: Any - ): - # type: (...) -> "_models.BindingResource" + resource_group_name: str, + service_name: str, + app_name: str, + binding_name: str, + binding_resource: "_models.BindingResource", + **kwargs: Any + ) -> "_models.BindingResource": cls = kwargs.pop('cls', None) # type: ClsType["_models.BindingResource"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-07-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._create_or_update_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - 'appName': self._serialize.url("app_name", app_name, 'str'), - 'bindingName': self._serialize.url("binding_name", binding_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + 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,18 +373,20 @@ 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 - service_name, # type: str - app_name, # type: str - binding_name, # type: str - binding_resource, # type: "_models.BindingResource" - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.BindingResource"] + resource_group_name: str, + service_name: str, + app_name: str, + binding_name: str, + binding_resource: "_models.BindingResource", + **kwargs: Any + ) -> 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 @@ -205,15 +402,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 +429,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,45 +455,35 @@ 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( self, - resource_group_name, # type: str - service_name, # type: str - app_name, # type: str - binding_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + resource_group_name: str, + service_name: str, + app_name: str, + binding_name: str, + **kwargs: Any + ) -> None: cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-07-01" - accept = "application/json" - - # Construct URL - url = self._delete_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - 'appName': self._serialize.url("app_name", app_name, 'str'), - 'bindingName': self._serialize.url("binding_name", binding_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = 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,15 +496,16 @@ 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 - service_name, # type: str - app_name, # type: str - binding_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> LROPoller[None] + resource_group_name: str, + service_name: str, + app_name: str, + binding_name: str, + **kwargs: Any + ) -> LROPoller[None]: """Operation to delete a Binding. :param resource_group_name: The name of the resource group that contains the resource. You can @@ -334,15 +519,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 +545,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,51 +564,41 @@ 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( 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" + resource_group_name: str, + service_name: str, + app_name: str, + binding_name: str, + binding_resource: "_models.BindingResource", + **kwargs: Any + ) -> "_models.BindingResource": cls = kwargs.pop('cls', None) # type: ClsType["_models.BindingResource"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-07-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._update_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - 'appName': self._serialize.url("app_name", app_name, 'str'), - 'bindingName': self._serialize.url("binding_name", binding_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + 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,18 +616,20 @@ 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 - service_name, # type: str - app_name, # type: str - binding_name, # type: str - binding_resource, # type: "_models.BindingResource" - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.BindingResource"] + resource_group_name: str, + service_name: str, + app_name: str, + binding_name: str, + binding_resource: "_models.BindingResource", + **kwargs: Any + ) -> 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 @@ -475,15 +645,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 +672,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,16 +698,17 @@ 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 - service_name, # type: str - app_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.BindingResourceCollection"] + resource_group_name: str, + service_name: str, + app_name: str, + **kwargs: Any + ) -> 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 @@ -551,8 +719,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 +730,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 +776,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 f60d181ac484..e68c17d453e6 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,25 +5,183 @@ # 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 +import functools +from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union 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 - -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]] +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +JSONType = Any +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_get_request( + subscription_id: str, + resource_group_name: str, + service_name: str, + certificate_name: str, + **kwargs: Any +) -> 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: str, + resource_group_name: str, + service_name: str, + certificate_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> 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, + json=json, + content=content, + **kwargs + ) + + +def build_delete_request_initial( + subscription_id: str, + resource_group_name: str, + service_name: str, + certificate_name: str, + **kwargs: Any +) -> 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: str, + resource_group_name: str, + service_name: str, + **kwargs: Any +) -> 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 + ) class CertificatesOperations(object): """CertificatesOperations operations. @@ -47,14 +205,14 @@ def __init__(self, client, config, serializer, deserializer): 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" + 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 @@ -74,28 +232,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,49 +257,40 @@ 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 - service_name, # type: str - certificate_name, # type: str - certificate_resource, # type: "_models.CertificateResource" - **kwargs # type: Any - ): - # type: (...) -> "_models.CertificateResource" + resource_group_name: str, + service_name: str, + certificate_name: str, + certificate_resource: "_models.CertificateResource", + **kwargs: Any + ) -> "_models.CertificateResource": cls = kwargs.pop('cls', None) # type: ClsType["_models.CertificateResource"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-07-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._create_or_update_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - 'certificateName': self._serialize.url("certificate_name", certificate_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + 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,17 +311,19 @@ 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 - service_name, # type: str - certificate_name, # type: str - certificate_resource, # type: "_models.CertificateResource" - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.CertificateResource"] + resource_group_name: str, + service_name: str, + certificate_name: str, + certificate_resource: "_models.CertificateResource", + **kwargs: Any + ) -> LROPoller["_models.CertificateResource"]: """Create or update certificate resource. :param resource_group_name: The name of the resource group that contains the resource. You can @@ -196,15 +337,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 +363,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,43 +389,33 @@ 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( self, - resource_group_name, # type: str - service_name, # type: str - certificate_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + resource_group_name: str, + service_name: str, + certificate_name: str, + **kwargs: Any + ) -> None: cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-07-01" - accept = "application/json" - - # Construct URL - url = self._delete_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - 'certificateName': self._serialize.url("certificate_name", certificate_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = 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,14 +428,15 @@ 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 - service_name, # type: str - certificate_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> LROPoller[None] + resource_group_name: str, + service_name: str, + certificate_name: str, + **kwargs: Any + ) -> LROPoller[None]: """Delete the certificate resource. :param resource_group_name: The name of the resource group that contains the resource. You can @@ -318,15 +448,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 +473,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,15 +492,16 @@ 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 - service_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.CertificateResourceCollection"] + resource_group_name: str, + service_name: str, + **kwargs: Any + ) -> 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 @@ -385,8 +510,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 +521,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 +565,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 c4dfb55f98b4..2f9dadde48e6 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,24 +5,194 @@ # 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 +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 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 - -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]] +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +JSONType = Any +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_get_request( + subscription_id: str, + resource_group_name: str, + service_name: str, + **kwargs: Any +) -> 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: str, + resource_group_name: str, + service_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> 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, + json=json, + content=content, + **kwargs + ) + + +def build_update_patch_request_initial( + subscription_id: str, + resource_group_name: str, + service_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> 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, + json=json, + content=content, + **kwargs + ) + + +def build_validate_request_initial( + subscription_id: str, + resource_group_name: str, + service_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> 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, + json=json, + content=content, + **kwargs + ) class ConfigServersOperations(object): """ConfigServersOperations operations. @@ -46,13 +216,13 @@ def __init__(self, client, config, serializer, deserializer): 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" + 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 @@ -70,27 +240,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,47 +264,38 @@ 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 - service_name, # type: str - config_server_resource, # type: "_models.ConfigServerResource" - **kwargs # type: Any - ): - # type: (...) -> "_models.ConfigServerResource" + resource_group_name: str, + service_name: str, + config_server_resource: "_models.ConfigServerResource", + **kwargs: Any + ) -> "_models.ConfigServerResource": cls = kwargs.pop('cls', None) # type: ClsType["_models.ConfigServerResource"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-07-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._update_put_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + 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,16 +313,18 @@ 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 - service_name, # type: str - config_server_resource, # type: "_models.ConfigServerResource" - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.ConfigServerResource"] + resource_group_name: str, + service_name: str, + config_server_resource: "_models.ConfigServerResource", + **kwargs: Any + ) -> LROPoller["_models.ConfigServerResource"]: """Update the config server. :param resource_group_name: The name of the resource group that contains the resource. You can @@ -183,15 +336,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 +361,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,47 +387,37 @@ 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( self, - resource_group_name, # type: str - service_name, # type: str - config_server_resource, # type: "_models.ConfigServerResource" - **kwargs # type: Any - ): - # type: (...) -> "_models.ConfigServerResource" + resource_group_name: str, + service_name: str, + config_server_resource: "_models.ConfigServerResource", + **kwargs: Any + ) -> "_models.ConfigServerResource": cls = kwargs.pop('cls', None) # type: ClsType["_models.ConfigServerResource"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-07-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._update_patch_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + 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_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,16 +435,18 @@ 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 - service_name, # type: str - config_server_resource, # type: "_models.ConfigServerResource" - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.ConfigServerResource"] + resource_group_name: str, + service_name: str, + config_server_resource: "_models.ConfigServerResource", + **kwargs: Any + ) -> LROPoller["_models.ConfigServerResource"]: """Update the config server. :param resource_group_name: The name of the resource group that contains the resource. You can @@ -314,15 +458,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 +483,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,47 +509,37 @@ 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( self, - resource_group_name, # type: str - service_name, # type: str - config_server_settings, # type: "_models.ConfigServerSettings" - **kwargs # type: Any - ): - # type: (...) -> "_models.ConfigServerSettingsValidateResult" + resource_group_name: str, + service_name: str, + config_server_settings: "_models.ConfigServerSettings", + **kwargs: Any + ) -> "_models.ConfigServerSettingsValidateResult": cls = kwargs.pop('cls', None) # type: ClsType["_models.ConfigServerSettingsValidateResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-07-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._validate_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + 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,16 +557,18 @@ 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 - service_name, # type: str - config_server_settings, # type: "_models.ConfigServerSettings" - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.ConfigServerSettingsValidateResult"] + resource_group_name: str, + service_name: str, + config_server_settings: "_models.ConfigServerSettings", + **kwargs: Any + ) -> 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 @@ -445,15 +580,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 +605,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 +631,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 4b7051f56c71..764cec32ccc1 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,25 +5,239 @@ # 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 +import functools +from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union 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 - -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]] +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +JSONType = Any +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_get_request( + subscription_id: str, + resource_group_name: str, + service_name: str, + app_name: str, + domain_name: str, + **kwargs: Any +) -> 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: str, + resource_group_name: str, + service_name: str, + app_name: str, + domain_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> 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, + json=json, + content=content, + **kwargs + ) + + +def build_delete_request_initial( + subscription_id: str, + resource_group_name: str, + service_name: str, + app_name: str, + domain_name: str, + **kwargs: Any +) -> 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: str, + resource_group_name: str, + service_name: str, + app_name: str, + domain_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> 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, + json=json, + content=content, + **kwargs + ) + + +def build_list_request( + subscription_id: str, + resource_group_name: str, + service_name: str, + app_name: str, + **kwargs: Any +) -> 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 + ) class CustomDomainsOperations(object): """CustomDomainsOperations operations. @@ -47,15 +261,15 @@ def __init__(self, client, config, serializer, deserializer): 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" + 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 @@ -77,29 +291,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,51 +317,42 @@ 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 - service_name, # type: str - app_name, # type: str - domain_name, # type: str - domain_resource, # type: "_models.CustomDomainResource" - **kwargs # type: Any - ): - # type: (...) -> "_models.CustomDomainResource" + resource_group_name: str, + service_name: str, + app_name: str, + domain_name: str, + domain_resource: "_models.CustomDomainResource", + **kwargs: Any + ) -> "_models.CustomDomainResource": cls = kwargs.pop('cls', None) # type: ClsType["_models.CustomDomainResource"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-07-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._create_or_update_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - 'appName': self._serialize.url("app_name", app_name, 'str'), - 'domainName': self._serialize.url("domain_name", domain_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + 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,18 +373,20 @@ 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 - service_name, # type: str - app_name, # type: str - domain_name, # type: str - domain_resource, # type: "_models.CustomDomainResource" - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.CustomDomainResource"] + resource_group_name: str, + service_name: str, + app_name: str, + domain_name: str, + domain_resource: "_models.CustomDomainResource", + **kwargs: Any + ) -> 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 @@ -205,15 +402,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 +429,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,45 +455,35 @@ 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( self, - resource_group_name, # type: str - service_name, # type: str - app_name, # type: str - domain_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + resource_group_name: str, + service_name: str, + app_name: str, + domain_name: str, + **kwargs: Any + ) -> None: cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-07-01" - accept = "application/json" - - # Construct URL - url = self._delete_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - 'appName': self._serialize.url("app_name", app_name, 'str'), - 'domainName': self._serialize.url("domain_name", domain_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = 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,15 +496,16 @@ 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 - service_name, # type: str - app_name, # type: str - domain_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> LROPoller[None] + resource_group_name: str, + service_name: str, + app_name: str, + domain_name: str, + **kwargs: Any + ) -> 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 @@ -334,15 +519,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 +545,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,51 +564,41 @@ 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( 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" + resource_group_name: str, + service_name: str, + app_name: str, + domain_name: str, + domain_resource: "_models.CustomDomainResource", + **kwargs: Any + ) -> "_models.CustomDomainResource": cls = kwargs.pop('cls', None) # type: ClsType["_models.CustomDomainResource"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-07-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._update_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - 'appName': self._serialize.url("app_name", app_name, 'str'), - 'domainName': self._serialize.url("domain_name", domain_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + 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,18 +616,20 @@ 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 - service_name, # type: str - app_name, # type: str - domain_name, # type: str - domain_resource, # type: "_models.CustomDomainResource" - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.CustomDomainResource"] + resource_group_name: str, + service_name: str, + app_name: str, + domain_name: str, + domain_resource: "_models.CustomDomainResource", + **kwargs: Any + ) -> 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 @@ -475,15 +645,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 +672,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,16 +698,17 @@ 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 - service_name, # type: str - app_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.CustomDomainResourceCollection"] + resource_group_name: str, + service_name: str, + app_name: str, + **kwargs: Any + ) -> 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 @@ -551,8 +719,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 +730,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 +776,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 7c9649aea65b..39feb19a06f7 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,25 +5,438 @@ # 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 +import functools +from typing import Any, Callable, Dict, Generic, Iterable, List, Optional, TypeVar, Union 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 - -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]] +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +JSONType = Any +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_get_request( + subscription_id: str, + resource_group_name: str, + service_name: str, + app_name: str, + deployment_name: str, + **kwargs: Any +) -> 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: str, + resource_group_name: str, + service_name: str, + app_name: str, + deployment_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> 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, + json=json, + content=content, + **kwargs + ) + + +def build_delete_request_initial( + subscription_id: str, + resource_group_name: str, + service_name: str, + app_name: str, + deployment_name: str, + **kwargs: Any +) -> 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: str, + resource_group_name: str, + service_name: str, + app_name: str, + deployment_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> 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, + json=json, + content=content, + **kwargs + ) + + +def build_list_request( + subscription_id: str, + resource_group_name: str, + service_name: str, + app_name: str, + *, + version: Optional[List[str]] = None, + **kwargs: Any +) -> 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') + 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: str, + resource_group_name: str, + service_name: str, + *, + version: Optional[List[str]] = None, + **kwargs: Any +) -> 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}/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: str, + resource_group_name: str, + service_name: str, + app_name: str, + deployment_name: str, + **kwargs: Any +) -> 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: str, + resource_group_name: str, + service_name: str, + app_name: str, + deployment_name: str, + **kwargs: Any +) -> 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: str, + resource_group_name: str, + service_name: str, + app_name: str, + deployment_name: str, + **kwargs: Any +) -> 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: str, + resource_group_name: str, + service_name: str, + app_name: str, + deployment_name: str, + **kwargs: Any +) -> 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 + ) class DeploymentsOperations(object): """DeploymentsOperations operations. @@ -47,15 +460,15 @@ def __init__(self, client, config, serializer, deserializer): 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" + 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 @@ -77,29 +490,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,51 +516,42 @@ 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 - service_name, # type: str - app_name, # type: str - deployment_name, # type: str - deployment_resource, # type: "_models.DeploymentResource" - **kwargs # type: Any - ): - # type: (...) -> "_models.DeploymentResource" + resource_group_name: str, + service_name: str, + app_name: str, + deployment_name: str, + deployment_resource: "_models.DeploymentResource", + **kwargs: Any + ) -> "_models.DeploymentResource": cls = kwargs.pop('cls', None) # type: ClsType["_models.DeploymentResource"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-07-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._create_or_update_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - 'appName': self._serialize.url("app_name", app_name, 'str'), - 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + 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,18 +572,20 @@ 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 - service_name, # type: str - app_name, # type: str - deployment_name, # type: str - deployment_resource, # type: "_models.DeploymentResource" - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.DeploymentResource"] + resource_group_name: str, + service_name: str, + app_name: str, + deployment_name: str, + deployment_resource: "_models.DeploymentResource", + **kwargs: Any + ) -> 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 @@ -205,15 +601,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 +628,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,45 +654,35 @@ 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( self, - resource_group_name, # type: str - service_name, # type: str - app_name, # type: str - deployment_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + resource_group_name: str, + service_name: str, + app_name: str, + deployment_name: str, + **kwargs: Any + ) -> None: cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-07-01" - accept = "application/json" - - # Construct URL - url = self._delete_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - 'appName': self._serialize.url("app_name", app_name, 'str'), - 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = 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,15 +695,16 @@ 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 - service_name, # type: str - app_name, # type: str - deployment_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> LROPoller[None] + resource_group_name: str, + service_name: str, + app_name: str, + deployment_name: str, + **kwargs: Any + ) -> LROPoller[None]: """Operation to delete a Deployment. :param resource_group_name: The name of the resource group that contains the resource. You can @@ -334,15 +718,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 +744,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,51 +763,41 @@ 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( 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" + resource_group_name: str, + service_name: str, + app_name: str, + deployment_name: str, + deployment_resource: "_models.DeploymentResource", + **kwargs: Any + ) -> "_models.DeploymentResource": cls = kwargs.pop('cls', None) # type: ClsType["_models.DeploymentResource"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-07-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._update_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - 'appName': self._serialize.url("app_name", app_name, 'str'), - 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(deployment_resource, 'DeploymentResource') - # 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, + 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,18 +815,20 @@ 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 - service_name, # type: str - app_name, # type: str - deployment_name, # type: str - deployment_resource, # type: "_models.DeploymentResource" - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.DeploymentResource"] + resource_group_name: str, + service_name: str, + app_name: str, + deployment_name: str, + deployment_resource: "_models.DeploymentResource", + **kwargs: Any + ) -> 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 @@ -475,15 +844,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 +871,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,17 +897,18 @@ 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 - service_name, # type: str - app_name, # type: str - version=None, # type: Optional[List[str]] - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.DeploymentResourceCollection"] + resource_group_name: str, + service_name: str, + app_name: str, + version: Optional[List[str]] = None, + **kwargs: Any + ) -> 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 @@ -554,8 +921,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 +932,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,19 +980,20 @@ 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 - service_name, # type: str - version=None, # type: Optional[List[str]] - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.DeploymentResourceCollection"] + resource_group_name: str, + service_name: str, + version: Optional[List[str]] = None, + **kwargs: Any + ) -> 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 @@ -636,8 +1004,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 +1015,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 +1061,7 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) @@ -701,41 +1069,30 @@ def get_next(next_link=None): 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 + resource_group_name: str, + service_name: str, + app_name: str, + deployment_name: str, + **kwargs: Any + ) -> None: cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-07-01" - accept = "application/json" - - # Construct URL - url = self._start_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - 'appName': self._serialize.url("app_name", app_name, 'str'), - 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = 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,15 +1105,16 @@ 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 - service_name, # type: str - app_name, # type: str - deployment_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> LROPoller[None] + resource_group_name: str, + service_name: str, + app_name: str, + deployment_name: str, + **kwargs: Any + ) -> LROPoller[None]: """Start the deployment. :param resource_group_name: The name of the resource group that contains the resource. You can @@ -770,15 +1128,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 +1154,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,45 +1173,35 @@ 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( self, - resource_group_name, # type: str - service_name, # type: str - app_name, # type: str - deployment_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + resource_group_name: str, + service_name: str, + app_name: str, + deployment_name: str, + **kwargs: Any + ) -> None: cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-07-01" - accept = "application/json" - - # Construct URL - url = self._stop_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - 'appName': self._serialize.url("app_name", app_name, 'str'), - 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = 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,15 +1214,16 @@ 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 - service_name, # type: str - app_name, # type: str - deployment_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> LROPoller[None] + resource_group_name: str, + service_name: str, + app_name: str, + deployment_name: str, + **kwargs: Any + ) -> LROPoller[None]: """Stop the deployment. :param resource_group_name: The name of the resource group that contains the resource. You can @@ -895,15 +1237,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 +1263,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,45 +1282,35 @@ 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( self, - resource_group_name, # type: str - service_name, # type: str - app_name, # type: str - deployment_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + resource_group_name: str, + service_name: str, + app_name: str, + deployment_name: str, + **kwargs: Any + ) -> None: cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-07-01" - accept = "application/json" - - # Construct URL - url = self._restart_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - 'appName': self._serialize.url("app_name", app_name, 'str'), - 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = 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,15 +1323,16 @@ 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 - service_name, # type: str - app_name, # type: str - deployment_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> LROPoller[None] + resource_group_name: str, + service_name: str, + app_name: str, + deployment_name: str, + **kwargs: Any + ) -> LROPoller[None]: """Restart the deployment. :param resource_group_name: The name of the resource group that contains the resource. You can @@ -1020,15 +1346,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 +1372,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,17 +1391,18 @@ 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 - service_name, # type: str - app_name, # type: str - deployment_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> Optional["_models.LogFileUrlResponse"] + 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 @@ -1104,29 +1424,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 +1452,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 417872e32c66..7a43ad585cec 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,24 +5,150 @@ # 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 +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 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 - -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]] +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +JSONType = Any +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_get_request( + subscription_id: str, + resource_group_name: str, + service_name: str, + **kwargs: Any +) -> 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: str, + resource_group_name: str, + service_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> 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, + json=json, + content=content, + **kwargs + ) + + +def build_update_patch_request_initial( + subscription_id: str, + resource_group_name: str, + service_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> 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, + json=json, + content=content, + **kwargs + ) class MonitoringSettingsOperations(object): """MonitoringSettingsOperations operations. @@ -46,13 +172,13 @@ def __init__(self, client, config, serializer, deserializer): 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" + 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 @@ -70,27 +196,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,47 +220,38 @@ 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 - service_name, # type: str - monitoring_setting_resource, # type: "_models.MonitoringSettingResource" - **kwargs # type: Any - ): - # type: (...) -> "_models.MonitoringSettingResource" + resource_group_name: str, + service_name: str, + monitoring_setting_resource: "_models.MonitoringSettingResource", + **kwargs: Any + ) -> "_models.MonitoringSettingResource": cls = kwargs.pop('cls', None) # type: ClsType["_models.MonitoringSettingResource"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-07-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._update_put_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(monitoring_setting_resource, 'MonitoringSettingResource') - # 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_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,16 +269,18 @@ 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 - service_name, # type: str - monitoring_setting_resource, # type: "_models.MonitoringSettingResource" - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.MonitoringSettingResource"] + resource_group_name: str, + service_name: str, + monitoring_setting_resource: "_models.MonitoringSettingResource", + **kwargs: Any + ) -> LROPoller["_models.MonitoringSettingResource"]: """Update the Monitoring Setting. :param resource_group_name: The name of the resource group that contains the resource. You can @@ -180,18 +289,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 +318,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,47 +344,37 @@ 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( self, - resource_group_name, # type: str - service_name, # type: str - monitoring_setting_resource, # type: "_models.MonitoringSettingResource" - **kwargs # type: Any - ): - # type: (...) -> "_models.MonitoringSettingResource" + resource_group_name: str, + service_name: str, + monitoring_setting_resource: "_models.MonitoringSettingResource", + **kwargs: Any + ) -> "_models.MonitoringSettingResource": cls = kwargs.pop('cls', None) # type: ClsType["_models.MonitoringSettingResource"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-07-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._update_patch_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + 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,16 +392,18 @@ 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 - service_name, # type: str - monitoring_setting_resource, # type: "_models.MonitoringSettingResource" - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.MonitoringSettingResource"] + resource_group_name: str, + service_name: str, + monitoring_setting_resource: "_models.MonitoringSettingResource", + **kwargs: Any + ) -> LROPoller["_models.MonitoringSettingResource"]: """Update the Monitoring Setting. :param resource_group_name: The name of the resource group that contains the resource. You can @@ -311,18 +412,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 +441,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 +467,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 8805b7072168..664c2504a17e 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,23 +5,50 @@ # 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 +import functools +from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar 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 - -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]] +from .._vendor import _convert_request +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_list_request( + **kwargs: Any +) -> 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 + ) class Operations(object): """Operations operations. @@ -45,16 +72,17 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def list( self, - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.AvailableOperations"] + **kwargs: Any + ) -> Iterable["_models.AvailableOperations"]: """Lists all of the available REST API operations of the Microsoft.AppPlatform provider. :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either AvailableOperations or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2020_07_01.models.AvailableOperations] + :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 +90,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 +128,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 0833e3170396..a5f4b183235d 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,22 +5,49 @@ # 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 +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 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 - -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]] +from .._vendor import _convert_request +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_list_runtime_versions_request( + **kwargs: Any +) -> 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 + ) class RuntimeVersionsOperations(object): """RuntimeVersionsOperations operations. @@ -44,11 +71,11 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def list_runtime_versions( self, - **kwargs # type: Any - ): - # type: (...) -> "_models.AvailableRuntimeVersions" + **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 @@ -61,21 +88,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') + + 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) - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -89,4 +109,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 6e2ae13f7743..d777031e2fc8 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,25 +5,441 @@ # 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 +import functools +from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union 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 - -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]] +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +JSONType = Any +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_get_request( + subscription_id: str, + resource_group_name: str, + service_name: str, + **kwargs: Any +) -> 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: str, + resource_group_name: str, + service_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> 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, + json=json, + content=content, + **kwargs + ) + + +def build_delete_request_initial( + subscription_id: str, + resource_group_name: str, + service_name: str, + **kwargs: Any +) -> 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: str, + resource_group_name: str, + service_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> 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, + json=json, + content=content, + **kwargs + ) + + +def build_list_test_keys_request( + subscription_id: str, + resource_group_name: str, + service_name: str, + **kwargs: Any +) -> 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: str, + resource_group_name: str, + service_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> 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, + json=json, + content=content, + **kwargs + ) + + +def build_disable_test_endpoint_request( + subscription_id: str, + resource_group_name: str, + service_name: str, + **kwargs: Any +) -> 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: str, + resource_group_name: str, + service_name: str, + **kwargs: Any +) -> 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: str, + location: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> 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, + json=json, + content=content, + **kwargs + ) + + +def build_list_by_subscription_request( + subscription_id: str, + **kwargs: Any +) -> 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: str, + resource_group_name: str, + **kwargs: Any +) -> 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 + ) class ServicesOperations(object): """ServicesOperations operations. @@ -47,13 +463,13 @@ def __init__(self, client, config, serializer, deserializer): 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" + 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 @@ -71,27 +487,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,47 +511,38 @@ 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 - service_name, # type: str - resource, # type: "_models.ServiceResource" - **kwargs # type: Any - ): - # type: (...) -> "_models.ServiceResource" + resource_group_name: str, + service_name: str, + resource: "_models.ServiceResource", + **kwargs: Any + ) -> "_models.ServiceResource": cls = kwargs.pop('cls', None) # type: ClsType["_models.ServiceResource"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-07-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._create_or_update_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(resource, 'ServiceResource') - # 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, + 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,16 +563,18 @@ 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 - service_name, # type: str - resource, # type: "_models.ServiceResource" - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.ServiceResource"] + resource_group_name: str, + service_name: str, + resource: "_models.ServiceResource", + **kwargs: Any + ) -> 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 @@ -187,15 +586,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 +611,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,41 +637,31 @@ 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( self, - resource_group_name, # type: str - service_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + resource_group_name: str, + service_name: str, + **kwargs: Any + ) -> None: cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-07-01" - accept = "application/json" - - # Construct URL - url = self._delete_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = 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,13 +674,14 @@ 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 - service_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> LROPoller[None] + resource_group_name: str, + service_name: str, + **kwargs: Any + ) -> LROPoller[None]: """Operation to delete a Service. :param resource_group_name: The name of the resource group that contains the resource. You can @@ -302,15 +691,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 +715,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,47 +734,37 @@ 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( self, - resource_group_name, # type: str - service_name, # type: str - resource, # type: "_models.ServiceResource" - **kwargs # type: Any - ): - # type: (...) -> "_models.ServiceResource" + resource_group_name: str, + service_name: str, + resource: "_models.ServiceResource", + **kwargs: Any + ) -> "_models.ServiceResource": cls = kwargs.pop('cls', None) # type: ClsType["_models.ServiceResource"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-07-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._update_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + 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,16 +782,18 @@ 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 - service_name, # type: str - resource, # type: "_models.ServiceResource" - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.ServiceResource"] + resource_group_name: str, + service_name: str, + resource: "_models.ServiceResource", + **kwargs: Any + ) -> 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 @@ -429,15 +805,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 +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: @@ -481,15 +856,16 @@ 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 - service_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.TestKeys" + 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 @@ -507,27 +883,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,16 +907,18 @@ 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 - service_name, # type: str - regenerate_test_key_request, # type: "_models.RegenerateTestKeyRequestPayload" - **kwargs # type: Any - ): - # type: (...) -> "_models.TestKeys" + 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 @@ -559,7 +927,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 +939,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,15 +968,17 @@ 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 - service_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + 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 @@ -635,27 +996,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,13 +1019,14 @@ 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 - service_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.TestKeys" + 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 @@ -692,27 +1044,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,21 +1068,24 @@ 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 - availability_parameters, # type: "_models.NameAvailabilityParameters" - **kwargs # type: Any - ): - # type: (...) -> "_models.NameAvailability" + location: str, + availability_parameters: "_models.NameAvailabilityParameters", + **kwargs: Any + ) -> "_models.NameAvailability": """Checks that the resource name is valid and is not already in use. :param location: the region. :type location: str :param availability_parameters: Parameters supplied to the operation. - :type availability_parameters: ~azure.mgmt.appplatform.v2020_07_01.models.NameAvailabilityParameters + :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 +1096,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,18 +1124,21 @@ 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 - ): - # type: (...) -> Iterable["_models.ServiceResourceList"] + **kwargs: Any + ) -> 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.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 +1146,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,17 +1186,18 @@ 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 - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.ServiceResourceList"] + resource_group_name: str, + **kwargs: Any + ) -> 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 @@ -871,7 +1205,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 +1214,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 +1256,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 4e05d050f701..4c6c22f3b2f8 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,23 +5,56 @@ # 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 +import functools +from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar 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 - -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]] +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_list_request( + subscription_id: str, + **kwargs: Any +) -> 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 + ) class SkusOperations(object): """SkusOperations operations. @@ -45,16 +78,18 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def list( self, - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.ResourceSkuCollection"] + **kwargs: Any + ) -> 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.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 +97,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 +137,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 d2ddf950056a..41ec6d71ff7f 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 3e902325d70e..1e15c6bae939 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,124 +6,115 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING +from copy import deepcopy +from typing import Any, Optional, TYPE_CHECKING +from azure.core.rest import HttpRequest, HttpResponse 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 - -class AppPlatformManagementClient(object): +class AppPlatformManagementClient: """REST API for Azure Spring Cloud. :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] - **kwargs # type: Any - ): - # type: (...) -> None - if not base_url: - base_url = 'https://management.azure.com' - self._config = AppPlatformManagementClientConfiguration(credential, subscription_id, **kwargs) + credential: "TokenCredential", + 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 = 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: Any + ) -> HttpResponse: """Runs the network request through the client's chained policies. - :param http_request: The network request you want to make. Required. - :type http_request: ~azure.core.pipeline.transport.HttpRequest - :keyword bool stream: Whether the response payload will be streamed. Defaults to True. + >>> 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 9678a78ee772..d30584010cd8 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 @@ -6,18 +6,16 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING +from typing import Any, TYPE_CHECKING from azure.core.configuration import Configuration from azure.core.pipeline import policies -from azure.mgmt.core.policies import ARMHttpLoggingPolicy +from 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 @@ -35,16 +33,15 @@ class AppPlatformManagementClientConfiguration(Configuration): def __init__( self, - credential, # type: "TokenCredential" - subscription_id, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + credential: "TokenCredential", + 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 @@ -68,4 +65,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 22c085a41a38..c64af47d0dc3 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 000000000000..74e48ecd07cf --- /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 000000000000..138f663c53a4 --- /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/aio/__init__.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2020_11_01_preview/aio/__init__.py index 39f105488735..44ce4a5043f8 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 5ca00dfff68a..d8df9d3ba84d 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 89cd6bbbc8e5..adb5d8c40822 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 000000000000..74e48ecd07cf --- /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 19ae52718842..1548d7fa9c99 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 77f8b3f7fe8c..5f1c51e64081 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 71b2ff176bef..6565bf8945af 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 175fc48484df..72f48be54800 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 40546c17e4ff..37101055e377 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 1428ce78df96..8923d93f8f0f 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 6ee477698c7a..13533b4fd398 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 4353874d4481..295fdb94f41a 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 a4d569401130..e190b2649562 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 b525473b065d..97b8dfd37245 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 7fe9f418d629..6eee76f7a805 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 6ff92bf6005d..97492b478eeb 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 @@ -6,148 +6,79 @@ # 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 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 CustomDomainProperties - from ._models_py3 import CustomDomainResource - from ._models_py3 import CustomDomainResourceCollection - from ._models_py3 import CustomDomainValidatePayload - from ._models_py3 import CustomDomainValidateResult - from ._models_py3 import DeploymentInstance - from ._models_py3 import DeploymentResource - from ._models_py3 import DeploymentResourceCollection - from ._models_py3 import DeploymentResourceProperties - from ._models_py3 import DeploymentSettings - from ._models_py3 import Error - from ._models_py3 import GitPatternRepository - from ._models_py3 import 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 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 SupportedRuntimeVersion - 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 BindingResource # type: ignore - from ._models import BindingResourceCollection # type: ignore - from ._models import BindingResourceProperties # type: ignore - from ._models import CertificateProperties # type: ignore - from ._models import CertificateResource # type: ignore - from ._models import CertificateResourceCollection # type: ignore - from ._models import CloudErrorBody # type: ignore - from ._models import ClusterResourceProperties # type: ignore - from ._models import ConfigServerGitProperty # type: ignore - from ._models import ConfigServerProperties # type: ignore - from ._models import ConfigServerResource # type: ignore - from ._models import ConfigServerSettings # type: ignore - from ._models import ConfigServerSettingsErrorRecord # type: ignore - from ._models import ConfigServerSettingsValidateResult # type: ignore - from ._models import CustomDomainProperties # type: ignore - from ._models import CustomDomainResource # type: ignore - from ._models import CustomDomainResourceCollection # type: ignore - from ._models import CustomDomainValidatePayload # type: ignore - from ._models import CustomDomainValidateResult # type: ignore - from ._models import DeploymentInstance # type: ignore - from ._models import DeploymentResource # type: ignore - from ._models import DeploymentResourceCollection # type: ignore - from ._models import DeploymentResourceProperties # type: ignore - from ._models import DeploymentSettings # type: ignore - from ._models import Error # type: ignore - from ._models import GitPatternRepository # type: ignore - from ._models import LogFileUrlResponse # type: ignore - from ._models import LogSpecification # type: ignore - from ._models import ManagedIdentityProperties # type: ignore - from ._models import MetricDimension # type: ignore - from ._models import MetricSpecification # type: ignore - from ._models import MonitoringSettingProperties # type: ignore - from ._models import MonitoringSettingResource # type: ignore - from ._models import NameAvailability # type: ignore - from ._models import NameAvailabilityParameters # type: ignore - from ._models import NetworkProfile # type: ignore - from ._models import NetworkProfileOutboundIPs # type: ignore - from ._models import OperationDetail # type: ignore - from ._models import OperationDisplay # type: ignore - from ._models import OperationProperties # type: ignore - from ._models import PersistentDisk # type: ignore - from ._models import ProxyResource # type: ignore - from ._models import RegenerateTestKeyRequestPayload # type: ignore - from ._models import RequiredTraffic # type: ignore - from ._models import Resource # type: ignore - from ._models import ResourceSku # type: ignore - from ._models import ResourceSkuCapabilities # type: ignore - from ._models import ResourceSkuCollection # type: ignore - from ._models import ResourceSkuLocationInfo # type: ignore - from ._models import ResourceSkuRestrictionInfo # type: ignore - from ._models import ResourceSkuRestrictions # type: ignore - from ._models import ResourceSkuZoneDetails # type: ignore - from ._models import ResourceUploadDefinition # type: ignore - from ._models import ServiceResource # type: ignore - from ._models import ServiceResourceList # type: ignore - from ._models import ServiceSpecification # type: ignore - from ._models import Sku # type: ignore - from ._models import SkuCapacity # type: ignore - from ._models import SupportedRuntimeVersion # type: ignore - from ._models import TemporaryDisk # type: ignore - from ._models import TestKeys # type: ignore - from ._models import TrackedResource # type: ignore - from ._models import UserSourceInfo # type: ignore +from ._models_py3 import AppResource +from ._models_py3 import AppResourceCollection +from ._models_py3 import AppResourceProperties +from ._models_py3 import ApplicationInsightsAgentVersions +from ._models_py3 import AvailableOperations +from ._models_py3 import AvailableRuntimeVersions +from ._models_py3 import BindingResource +from ._models_py3 import BindingResourceCollection +from ._models_py3 import BindingResourceProperties +from ._models_py3 import CertificateProperties +from ._models_py3 import CertificateResource +from ._models_py3 import CertificateResourceCollection +from ._models_py3 import CloudErrorBody +from ._models_py3 import ClusterResourceProperties +from ._models_py3 import ConfigServerGitProperty +from ._models_py3 import ConfigServerProperties +from ._models_py3 import ConfigServerResource +from ._models_py3 import ConfigServerSettings +from ._models_py3 import ConfigServerSettingsErrorRecord +from ._models_py3 import ConfigServerSettingsValidateResult +from ._models_py3 import CustomDomainProperties +from ._models_py3 import CustomDomainResource +from ._models_py3 import CustomDomainResourceCollection +from ._models_py3 import CustomDomainValidatePayload +from ._models_py3 import CustomDomainValidateResult +from ._models_py3 import DeploymentInstance +from ._models_py3 import DeploymentResource +from ._models_py3 import DeploymentResourceCollection +from ._models_py3 import DeploymentResourceProperties +from ._models_py3 import DeploymentSettings +from ._models_py3 import Error +from ._models_py3 import GitPatternRepository +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 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 SupportedRuntimeVersion +from ._models_py3 import TemporaryDisk +from ._models_py3 import TestKeys +from ._models_py3 import TrackedResource +from ._models_py3 import UserSourceInfo + from ._app_platform_management_client_enums import ( + ActionType, AppResourceProvisioningState, ConfigServerState, DeploymentResourceProvisioningState, @@ -236,6 +167,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 5ac8dede62c0..483260921151 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 deleted file mode 100644 index 6a3b321f02f4..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2020_11_01_preview/models/_models.py +++ /dev/null @@ -1,2401 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -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 - :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 - """ - - _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 - ): - 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. - - :param value: Collection of App resources. - :type value: list[~azure.mgmt.appplatform.v2020_11_01_preview.models.AppResource] - :param next_link: URL client should use to fetch the next page (per server side paging). - It's null for now, added for future use. - :type next_link: str - """ - - _attribute_map = { - 'value': {'key': 'value', 'type': '[AppResource]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(AppResourceCollection, self).__init__(**kwargs) - self.value = kwargs.get('value', None) - self.next_link = kwargs.get('next_link', None) - - -class AppResourceProperties(msrest.serialization.Model): - """App resource properties payload. - - Variables are only populated by the server, and will be ignored when sending a request. - - :param public: Indicates whether the App exposes public endpoint. - :type 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 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 - """ - - _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'}, - 'enable_end_to_end_tls': {'key': 'enableEndToEndTLS', 'type': 'bool'}, - } - - def __init__( - self, - **kwargs - ): - super(AppResourceProperties, self).__init__(**kwargs) - self.public = kwargs.get('public', None) - self.url = None - self.provisioning_state = None - self.active_deployment_name = kwargs.get('active_deployment_name', None) - self.fqdn = kwargs.get('fqdn', None) - self.https_only = kwargs.get('https_only', 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', False) - - -class AvailableOperations(msrest.serialization.Model): - """Available operations of the service. - - :param value: Collection of available operation details. - :type value: list[~azure.mgmt.appplatform.v2020_11_01_preview.models.OperationDetail] - :param next_link: URL client should use to fetch the next page (per server side paging). - It's null for now, added for future use. - :type next_link: str - """ - - _attribute_map = { - 'value': {'key': 'value', 'type': '[OperationDetail]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(AvailableOperations, self).__init__(**kwargs) - self.value = kwargs.get('value', None) - self.next_link = kwargs.get('next_link', None) - - -class AvailableRuntimeVersions(msrest.serialization.Model): - """AvailableRuntimeVersions. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar value: A list of all supported runtime versions. - :vartype value: - list[~azure.mgmt.appplatform.v2020_11_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 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 - :param properties: Properties of the Binding resource. - :type properties: ~azure.mgmt.appplatform.v2020_11_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 - ): - 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. - - :param value: Collection of Binding resources. - :type value: list[~azure.mgmt.appplatform.v2020_11_01_preview.models.BindingResource] - :param next_link: URL client should use to fetch the next page (per server side paging). - It's null for now, added for future use. - :type next_link: str - """ - - _attribute_map = { - 'value': {'key': 'value', 'type': '[BindingResource]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(BindingResourceCollection, self).__init__(**kwargs) - self.value = kwargs.get('value', None) - self.next_link = kwargs.get('next_link', None) - - -class BindingResourceProperties(msrest.serialization.Model): - """Binding resource properties payload. - - Variables are only populated by the server, and will be ignored when sending a request. - - :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 - :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 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 - ): - 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. - - 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 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 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 = { - 'thumbprint': {'readonly': True}, - 'vault_uri': {'required': True}, - 'key_vault_cert_name': {'required': 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 = { - 'thumbprint': {'key': 'thumbprint', 'type': 'str'}, - 'vault_uri': {'key': 'vaultUri', 'type': 'str'}, - 'key_vault_cert_name': {'key': 'keyVaultCertName', 'type': 'str'}, - 'cert_version': {'key': 'certVersion', '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]'}, - } - - def __init__( - self, - **kwargs - ): - super(CertificateProperties, self).__init__(**kwargs) - self.thumbprint = None - self.vault_uri = kwargs['vault_uri'] - self.key_vault_cert_name = kwargs['key_vault_cert_name'] - self.cert_version = kwargs.get('cert_version', None) - self.issuer = None - self.issued_date = None - 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 - :param properties: Properties of the certificate resource payload. - :type properties: ~azure.mgmt.appplatform.v2020_11_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 - ): - 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. - - :param value: The certificate resources list. - :type value: list[~azure.mgmt.appplatform.v2020_11_01_preview.models.CertificateResource] - :param next_link: The link to next page of certificate list. - :type next_link: str - """ - - _attribute_map = { - 'value': {'key': 'value', 'type': '[CertificateResource]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(CertificateResourceCollection, self).__init__(**kwargs) - self.value = kwargs.get('value', None) - self.next_link = kwargs.get('next_link', None) - - -class CloudErrorBody(msrest.serialization.Model): - """An error response from the service. - - :param code: An identifier for the error. Codes are invariant and are intended to be consumed - programmatically. - :type code: str - :param message: A message describing the error, intended to be suitable for display in a user - interface. - :type message: str - :param target: The target of the particular error. For example, the name of the property in - error. - :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] - """ - - _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 - ): - 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.v2020_11_01_preview.models.ProvisioningState - :param network_profile: Network profile of the Service. - :type network_profile: ~azure.mgmt.appplatform.v2020_11_01_preview.models.NetworkProfile - :ivar version: Version of the Service. - :vartype version: int - :ivar service_id: ServiceInstanceEntity GUID which uniquely identifies a created resource. - :vartype service_id: str - """ - - _validation = { - 'provisioning_state': {'readonly': True}, - 'version': {'readonly': True}, - 'service_id': {'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'}, - } - - def __init__( - self, - **kwargs - ): - super(ClusterResourceProperties, self).__init__(**kwargs) - self.provisioning_state = None - self.network_profile = kwargs.get('network_profile', None) - self.version = None - self.service_id = None - - -class ConfigServerGitProperty(msrest.serialization.Model): - """Property of git. - - All required parameters must be populated in order to send to Azure. - - :param repositories: Repositories of git. - :type repositories: - list[~azure.mgmt.appplatform.v2020_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 - """ - - _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 - ): - 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.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 - """ - - _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 - ): - 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 - :param properties: Properties of the Config Server resource. - :type properties: ~azure.mgmt.appplatform.v2020_11_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 - ): - super(ConfigServerResource, self).__init__(**kwargs) - self.properties = kwargs.get('properties', None) - - -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 - """ - - _attribute_map = { - 'git_property': {'key': 'gitProperty', 'type': 'ConfigServerGitProperty'}, - } - - def __init__( - self, - **kwargs - ): - 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. - - :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] - """ - - _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'uri': {'key': 'uri', 'type': 'str'}, - 'messages': {'key': 'messages', 'type': '[str]'}, - } - - def __init__( - self, - **kwargs - ): - super(ConfigServerSettingsErrorRecord, self).__init__(**kwargs) - self.name = kwargs.get('name', None) - self.uri = kwargs.get('uri', None) - self.messages = kwargs.get('messages', None) - - -class ConfigServerSettingsValidateResult(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_11_01_preview.models.ConfigServerSettingsErrorRecord] - """ - - _attribute_map = { - 'is_valid': {'key': 'isValid', 'type': 'bool'}, - 'details': {'key': 'details', 'type': '[ConfigServerSettingsErrorRecord]'}, - } - - def __init__( - self, - **kwargs - ): - super(ConfigServerSettingsValidateResult, self).__init__(**kwargs) - self.is_valid = kwargs.get('is_valid', None) - self.details = kwargs.get('details', None) - - -class CustomDomainProperties(msrest.serialization.Model): - """Custom domain of app resource payload. - - 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 app_name: The app name of domain. - :vartype app_name: str - :param cert_name: The bound certificate name of domain. - :type 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 - ): - 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 - :param properties: Properties of the custom domain resource. - :type properties: ~azure.mgmt.appplatform.v2020_11_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 - ): - 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. - - :param value: The custom domain resources list. - :type value: list[~azure.mgmt.appplatform.v2020_11_01_preview.models.CustomDomainResource] - :param next_link: The link to next page of custom domain list. - :type next_link: str - """ - - _attribute_map = { - 'value': {'key': 'value', 'type': '[CustomDomainResource]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(CustomDomainResourceCollection, self).__init__(**kwargs) - self.value = kwargs.get('value', None) - self.next_link = kwargs.get('next_link', None) - - -class CustomDomainValidatePayload(msrest.serialization.Model): - """Custom domain validate payload. - - All required parameters must be populated in order to send to Azure. - - :param name: Required. Name to be validated. - :type name: str - """ - - _validation = { - 'name': {'required': True}, - } - - _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(CustomDomainValidatePayload, self).__init__(**kwargs) - self.name = kwargs['name'] - - -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 - """ - - _attribute_map = { - 'is_valid': {'key': 'isValid', 'type': 'bool'}, - 'message': {'key': 'message', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(CustomDomainValidateResult, self).__init__(**kwargs) - self.is_valid = kwargs.get('is_valid', None) - self.message = kwargs.get('message', None) - - -class DeploymentInstance(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 - :param properties: Properties of the Deployment resource. - :type properties: - ~azure.mgmt.appplatform.v2020_11_01_preview.models.DeploymentResourceProperties - :param sku: Sku of the Deployment resource. - :type sku: ~azure.mgmt.appplatform.v2020_11_01_preview.models.Sku - """ - - _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 - ): - 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. - - :param value: Collection of Deployment resources. - :type value: list[~azure.mgmt.appplatform.v2020_11_01_preview.models.DeploymentResource] - :param next_link: URL client should use to fetch the next page (per server side paging). - It's null for now, added for future use. - :type next_link: str - """ - - _attribute_map = { - 'value': {'key': 'value', 'type': '[DeploymentResource]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(DeploymentResourceCollection, self).__init__(**kwargs) - self.value = kwargs.get('value', None) - self.next_link = kwargs.get('next_link', None) - - -class DeploymentResourceProperties(msrest.serialization.Model): - """Deployment resource properties payload. - - Variables are only populated by the server, and will be ignored when sending a request. - - :param source: Uploaded source information of the deployment. - :type source: ~azure.mgmt.appplatform.v2020_11_01_preview.models.UserSourceInfo - :ivar app_name: App name of the deployment. - :vartype app_name: str - :param deployment_settings: Deployment settings of the Deployment. - :type deployment_settings: - ~azure.mgmt.appplatform.v2020_11_01_preview.models.DeploymentSettings - :ivar provisioning_state: Provisioning state of the Deployment. Possible values include: - "Creating", "Updating", "Succeeded", "Failed". - :vartype provisioning_state: str or - ~azure.mgmt.appplatform.v2020_11_01_preview.models.DeploymentResourceProvisioningState - :ivar status: Status of the Deployment. Possible values include: "Unknown", "Stopped", - "Running", "Failed", "Allocating", "Upgrading", "Compiling". - :vartype status: str or - ~azure.mgmt.appplatform.v2020_11_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.v2020_11_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 - ): - 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. - - :param cpu: Required CPU, basic tier should be 1, standard tier should be in range (1, 4). - :type cpu: int - :param memory_in_gb: Required Memory size in GB, basic tier should be in range (1, 2), standard - tier should be in range (1, 8). - :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", - "NetCore_31". Default value: "Java_8". - :type runtime_version: str or ~azure.mgmt.appplatform.v2020_11_01_preview.models.RuntimeVersion - """ - - _attribute_map = { - 'cpu': {'key': 'cpu', 'type': 'int'}, - 'memory_in_gb': {'key': 'memoryInGB', 'type': 'int'}, - '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'}, - } - - def __init__( - self, - **kwargs - ): - super(DeploymentSettings, self).__init__(**kwargs) - self.cpu = kwargs.get('cpu', 1) - self.memory_in_gb = kwargs.get('memory_in_gb', 1) - self.jvm_options = kwargs.get('jvm_options', None) - self.net_core_main_entry_path = kwargs.get('net_core_main_entry_path', None) - self.environment_variables = kwargs.get('environment_variables', None) - self.runtime_version = kwargs.get('runtime_version', "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 - """ - - _attribute_map = { - 'code': {'key': 'code', 'type': 'str'}, - 'message': {'key': 'message', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - 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. - - :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 - """ - - _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 - ): - 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 LogFileUrlResponse(msrest.serialization.Model): - """Log file URL payload. - - All required parameters must be populated in order to send to Azure. - - :param url: Required. URL of the log file. - :type url: str - """ - - _validation = { - 'url': {'required': True}, - } - - _attribute_map = { - 'url': {'key': 'url', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(LogFileUrlResponse, self).__init__(**kwargs) - self.url = kwargs['url'] - - -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 - """ - - _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'display_name': {'key': 'displayName', 'type': 'str'}, - 'blob_duration': {'key': 'blobDuration', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(LogSpecification, self).__init__(**kwargs) - self.name = kwargs.get('name', None) - self.display_name = kwargs.get('display_name', None) - self.blob_duration = kwargs.get('blob_duration', None) - - -class ManagedIdentityProperties(msrest.serialization.Model): - """Managed identity properties retrieved from ARM request headers. - - :param type: Type of the managed identity. Possible values include: "None", "SystemAssigned", - "UserAssigned", "SystemAssigned,UserAssigned". - :type type: str or ~azure.mgmt.appplatform.v2020_11_01_preview.models.ManagedIdentityType - :param principal_id: Principal Id. - :type principal_id: str - :param tenant_id: Tenant Id. - :type 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 - ): - 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. - - :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 - export scenario. - :type to_be_exported_for_shoebox: bool - """ - - _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'display_name': {'key': 'displayName', 'type': 'str'}, - 'to_be_exported_for_shoebox': {'key': 'toBeExportedForShoebox', 'type': 'bool'}, - } - - def __init__( - self, - **kwargs - ): - 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. - - :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 - belong to a single category. - :type category: str - :param aggregation_type: Only provide one value for this field. Valid values: Average, Minimum, - Maximum, Total, Count. - :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 - 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] - """ - - _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]'}, - } - - def __init__( - self, - **kwargs - ): - 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) - - -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.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, - 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: - ~azure.mgmt.appplatform.v2020_11_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 - ): - 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 - :param properties: Properties of the Monitoring Setting resource. - :type properties: - ~azure.mgmt.appplatform.v2020_11_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 - ): - super(MonitoringSettingResource, self).__init__(**kwargs) - self.properties = kwargs.get('properties', 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 - """ - - _attribute_map = { - 'name_available': {'key': 'nameAvailable', 'type': 'bool'}, - 'reason': {'key': 'reason', 'type': 'str'}, - 'message': {'key': 'message', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(NameAvailability, self).__init__(**kwargs) - self.name_available = kwargs.get('name_available', None) - self.reason = kwargs.get('reason', None) - self.message = kwargs.get('message', None) - - -class NameAvailabilityParameters(msrest.serialization.Model): - """Name availability parameters payload. - - All required parameters must be populated in order to send to Azure. - - :param type: Required. Type of the resource to check name availability. - :type type: str - :param name: Required. Name to be checked. - :type 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 - ): - 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. - - :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 - resources of Azure Spring Cloud Service Runtime. - :type service_runtime_network_resource_group: str - :param app_network_resource_group: Name of the resource group containing network resources of - Azure Spring Cloud Apps. - :type 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 - :ivar required_traffics: Required inbound or outbound traffics for Azure Spring Cloud instance. - :vartype required_traffics: - list[~azure.mgmt.appplatform.v2020_11_01_preview.models.RequiredTraffic] - """ - - _validation = { - 'outbound_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 - ): - 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. - - :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 - """ - - _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'is_data_action': {'key': 'isDataAction', 'type': 'bool'}, - 'display': {'key': 'display', 'type': 'OperationDisplay'}, - 'origin': {'key': 'origin', 'type': 'str'}, - 'properties': {'key': 'properties', 'type': 'OperationProperties'}, - } - - def __init__( - self, - **kwargs - ): - super(OperationDetail, self).__init__(**kwargs) - self.name = kwargs.get('name', None) - self.is_data_action = kwargs.get('is_data_action', None) - self.display = kwargs.get('display', None) - self.origin = kwargs.get('origin', None) - self.properties = kwargs.get('properties', None) - - -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 - """ - - _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 - ): - 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. - - :param service_specification: Service specifications of the operation. - :type service_specification: - ~azure.mgmt.appplatform.v2020_11_01_preview.models.ServiceSpecification - """ - - _attribute_map = { - 'service_specification': {'key': 'serviceSpecification', 'type': 'ServiceSpecification'}, - } - - def __init__( - self, - **kwargs - ): - 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. - - :param size_in_gb: Size of the persistent disk in GB. - :type size_in_gb: int - :ivar used_in_gb: Size of the used persistent disk in GB. - :vartype used_in_gb: int - :param mount_path: Mount path of the persistent disk. - :type 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 - ): - 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. - - :param key_type: Required. Type of the test key. Possible values include: "Primary", - "Secondary". - :type key_type: str or ~azure.mgmt.appplatform.v2020_11_01_preview.models.TestKeyType - """ - - _validation = { - 'key_type': {'required': True}, - } - - _attribute_map = { - 'key_type': {'key': 'keyType', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - 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.v2020_11_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 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 - the SKU is available. - :type location_info: - list[~azure.mgmt.appplatform.v2020_11_01_preview.models.ResourceSkuLocationInfo] - :param restrictions: Gets the restrictions because of which SKU cannot be used. This is - empty if there are no restrictions. - :type restrictions: - list[~azure.mgmt.appplatform.v2020_11_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 - ): - 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. - - :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 - """ - - _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'value': {'key': 'value', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - 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. - - :param value: Collection of resource SKU. - :type value: list[~azure.mgmt.appplatform.v2020_11_01_preview.models.ResourceSku] - :param next_link: URL client should use to fetch the next page (per server side paging). - It's null for now, added for future use. - :type next_link: str - """ - - _attribute_map = { - 'value': {'key': 'value', 'type': '[ResourceSku]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(ResourceSkuCollection, self).__init__(**kwargs) - self.value = kwargs.get('value', None) - self.next_link = kwargs.get('next_link', None) - - -class ResourceSkuLocationInfo(msrest.serialization.Model): - """Locations and availability zones where the SKU is available. - - :param location: Gets location of the SKU. - :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_11_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 - ): - 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. - - :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] - """ - - _attribute_map = { - 'locations': {'key': 'locations', 'type': '[str]'}, - 'zones': {'key': 'zones', 'type': '[str]'}, - } - - def __init__( - self, - **kwargs - ): - 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. - - :param type: Gets the type of restrictions. Possible values include: 'Location', 'Zone'. - Possible values include: "Location", "Zone". - :type type: str or - ~azure.mgmt.appplatform.v2020_11_01_preview.models.ResourceSkuRestrictionsType - :param values: Gets the value of restrictions. If the restriction type is set to - location. This would be different locations where the SKU is restricted. - :type values: list[str] - :param restriction_info: Gets the information about the restriction where the SKU cannot be - used. - :type restriction_info: - ~azure.mgmt.appplatform.v2020_11_01_preview.models.ResourceSkuRestrictionInfo - :param reason_code: Gets the reason for restriction. Possible values include: 'QuotaId', - 'NotAvailableForSubscription'. Possible values include: "QuotaId", - "NotAvailableForSubscription". - :type reason_code: str or - ~azure.mgmt.appplatform.v2020_11_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 - ): - 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. - - :param name: Gets the set of zones that the SKU is available in with the - specified capabilities. - :type name: list[str] - :param capabilities: Gets a list of capabilities that are available for the SKU in the - specified list of zones. - :type capabilities: - list[~azure.mgmt.appplatform.v2020_11_01_preview.models.ResourceSkuCapabilities] - """ - - _attribute_map = { - 'name': {'key': 'name', 'type': '[str]'}, - 'capabilities': {'key': 'capabilities', 'type': '[ResourceSkuCapabilities]'}, - } - - def __init__( - self, - **kwargs - ): - 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. - - :param relative_path: Source relative path. - :type relative_path: str - :param upload_url: Upload URL. - :type upload_url: str - """ - - _attribute_map = { - 'relative_path': {'key': 'relativePath', 'type': 'str'}, - 'upload_url': {'key': 'uploadUrl', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(ResourceUploadDefinition, self).__init__(**kwargs) - self.relative_path = kwargs.get('relative_path', None) - self.upload_url = kwargs.get('upload_url', None) - - -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 - :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] - """ - - _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 - ): - 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 - :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 - """ - - _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 - ): - 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. - - :param value: Collection of Service resources. - :type value: list[~azure.mgmt.appplatform.v2020_11_01_preview.models.ServiceResource] - :param next_link: URL client should use to fetch the next page (per server side paging). - It's null for now, added for future use. - :type next_link: str - """ - - _attribute_map = { - 'value': {'key': 'value', 'type': '[ServiceResource]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(ServiceResourceList, self).__init__(**kwargs) - self.value = kwargs.get('value', None) - self.next_link = kwargs.get('next_link', None) - - -class ServiceSpecification(msrest.serialization.Model): - """Service specification payload. - - :param log_specifications: Specifications of the Log for Azure Monitoring. - :type 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: - list[~azure.mgmt.appplatform.v2020_11_01_preview.models.MetricSpecification] - """ - - _attribute_map = { - 'log_specifications': {'key': 'logSpecifications', 'type': '[LogSpecification]'}, - 'metric_specifications': {'key': 'metricSpecifications', 'type': '[MetricSpecification]'}, - } - - def __init__( - self, - **kwargs - ): - super(ServiceSpecification, self).__init__(**kwargs) - self.log_specifications = kwargs.get('log_specifications', None) - self.metric_specifications = kwargs.get('metric_specifications', None) - - -class Sku(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 - """ - - _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'tier': {'key': 'tier', 'type': 'str'}, - 'capacity': {'key': 'capacity', 'type': 'int'}, - } - - def __init__( - self, - **kwargs - ): - super(Sku, self).__init__(**kwargs) - self.name = kwargs.get('name', "S0") - self.tier = kwargs.get('tier', "Standard") - self.capacity = kwargs.get('capacity', None) - - -class SkuCapacity(msrest.serialization.Model): - """The SKU capacity. - - 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", - "Manual", "Automatic". - :type scale_type: str or ~azure.mgmt.appplatform.v2020_11_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 - ): - 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 SupportedRuntimeVersion(msrest.serialization.Model): - """Supported deployment runtime version descriptor. - - :param value: The raw value which could be passed to deployment CRUD operations. Possible - values include: "Java_8", "Java_11", "NetCore_31". - :type value: str or ~azure.mgmt.appplatform.v2020_11_01_preview.models.SupportedRuntimeValue - :param platform: The platform of this runtime version (possible values: "Java" or ".NET"). - Possible values include: "Java", ".NET Core". - :type 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 - """ - - _attribute_map = { - 'value': {'key': 'value', 'type': 'str'}, - 'platform': {'key': 'platform', 'type': 'str'}, - 'version': {'key': 'version', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(SupportedRuntimeVersion, self).__init__(**kwargs) - self.value = kwargs.get('value', None) - self.platform = kwargs.get('platform', None) - self.version = kwargs.get('version', None) - - -class TemporaryDisk(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 - """ - - _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 - ): - 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. - - :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 - """ - - _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 - ): - 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. - - :param type: Type of the source uploaded. Possible values include: "Jar", "NetCoreZip", - "Source". - :type type: str or ~azure.mgmt.appplatform.v2020_11_01_preview.models.UserSourceType - :param relative_path: Relative path of the storage which stores the source. - :type relative_path: str - :param version: Version of the source. - :type version: str - :param artifact_selector: Selector for the artifact to be used for the deployment for - multi-module projects. This should be - the relative path to the target module/project. - :type artifact_selector: str - """ - - _attribute_map = { - 'type': {'key': 'type', 'type': 'str'}, - 'relative_path': {'key': 'relativePath', 'type': 'str'}, - 'version': {'key': 'version', 'type': 'str'}, - 'artifact_selector': {'key': 'artifactSelector', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(UserSourceInfo, self).__init__(**kwargs) - self.type = kwargs.get('type', None) - self.relative_path = kwargs.get('relative_path', None) - self.version = kwargs.get('version', None) - self.artifact_selector = kwargs.get('artifact_selector', None) 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 ad133e58850c..b933174dc563 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 2b9bcb3d68bd..9c0f3381564b 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,25 +5,316 @@ # 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 +import functools +from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union 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 - -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]] +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +JSONType = Any +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_get_request( + subscription_id: str, + resource_group_name: str, + service_name: str, + app_name: str, + *, + sync_status: Optional[str] = None, + **kwargs: Any +) -> 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') + 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: str, + resource_group_name: str, + service_name: str, + app_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> 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, + json=json, + content=content, + **kwargs + ) + + +def build_delete_request_initial( + subscription_id: str, + resource_group_name: str, + service_name: str, + app_name: str, + **kwargs: Any +) -> 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: str, + resource_group_name: str, + service_name: str, + app_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> 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, + json=json, + content=content, + **kwargs + ) + + +def build_list_request( + subscription_id: str, + resource_group_name: str, + service_name: str, + **kwargs: Any +) -> 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: str, + resource_group_name: str, + service_name: str, + app_name: str, + **kwargs: Any +) -> 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: str, + resource_group_name: str, + service_name: str, + app_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> 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, + json=json, + content=content, + **kwargs + ) class AppsOperations(object): """AppsOperations operations. @@ -47,15 +338,15 @@ def __init__(self, client, config, serializer, deserializer): 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" + 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 @@ -77,30 +368,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,49 +394,40 @@ 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 - service_name, # type: str - app_name, # type: str - app_resource, # type: "_models.AppResource" - **kwargs # type: Any - ): - # type: (...) -> "_models.AppResource" + resource_group_name: str, + service_name: str, + app_name: str, + app_resource: "_models.AppResource", + **kwargs: Any + ) -> "_models.AppResource": cls = kwargs.pop('cls', None) # type: ClsType["_models.AppResource"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-11-01-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._create_or_update_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - 'appName': self._serialize.url("app_name", app_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + 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 @@ -177,17 +448,19 @@ 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 - service_name, # type: str - app_name, # type: str - app_resource, # type: "_models.AppResource" - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.AppResource"] + resource_group_name: str, + service_name: str, + app_name: str, + app_resource: "_models.AppResource", + **kwargs: Any + ) -> 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 @@ -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,43 +526,33 @@ 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( self, - resource_group_name, # type: str - service_name, # type: str - app_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + resource_group_name: str, + service_name: str, + app_name: str, + **kwargs: Any + ) -> None: cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-11-01-preview" - accept = "application/json" - - # Construct URL - url = self._delete_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - 'appName': self._serialize.url("app_name", app_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = 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,14 +565,15 @@ 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 - service_name, # type: str - app_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> LROPoller[None] + resource_group_name: str, + service_name: str, + app_name: str, + **kwargs: Any + ) -> LROPoller[None]: """Operation to delete an App. :param resource_group_name: The name of the resource group that contains the resource. You can @@ -323,15 +585,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 +610,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,49 +629,39 @@ 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( 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" + resource_group_name: str, + service_name: str, + app_name: str, + app_resource: "_models.AppResource", + **kwargs: Any + ) -> "_models.AppResource": cls = kwargs.pop('cls', None) # type: ClsType["_models.AppResource"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-11-01-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._update_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - 'appName': self._serialize.url("app_name", app_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + 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,17 +679,19 @@ 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 - service_name, # type: str - app_name, # type: str - app_resource, # type: "_models.AppResource" - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.AppResource"] + resource_group_name: str, + service_name: str, + app_name: str, + app_resource: "_models.AppResource", + **kwargs: Any + ) -> 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 @@ -457,15 +705,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 +731,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,15 +757,16 @@ 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 - service_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.AppResourceCollection"] + resource_group_name: str, + service_name: str, + **kwargs: Any + ) -> 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 @@ -528,8 +775,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 +786,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,19 +830,20 @@ 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 - service_name, # type: str - app_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.ResourceUploadDefinition" + 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 @@ -616,28 +863,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,17 +888,19 @@ 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 - service_name, # type: str - app_name, # type: str - validate_payload, # type: "_models.CustomDomainValidatePayload" - **kwargs # type: Any - ): - # type: (...) -> "_models.CustomDomainValidateResult" + 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 @@ -672,7 +911,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 +923,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 +953,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 d2d143d85724..b35bbff1552b 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,25 +5,239 @@ # 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 +import functools +from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union 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 - -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]] +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +JSONType = Any +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_get_request( + subscription_id: str, + resource_group_name: str, + service_name: str, + app_name: str, + binding_name: str, + **kwargs: Any +) -> 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: str, + resource_group_name: str, + service_name: str, + app_name: str, + binding_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> 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, + json=json, + content=content, + **kwargs + ) + + +def build_delete_request_initial( + subscription_id: str, + resource_group_name: str, + service_name: str, + app_name: str, + binding_name: str, + **kwargs: Any +) -> 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: str, + resource_group_name: str, + service_name: str, + app_name: str, + binding_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> 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, + json=json, + content=content, + **kwargs + ) + + +def build_list_request( + subscription_id: str, + resource_group_name: str, + service_name: str, + app_name: str, + **kwargs: Any +) -> 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 + ) class BindingsOperations(object): """BindingsOperations operations. @@ -47,15 +261,15 @@ def __init__(self, client, config, serializer, deserializer): 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" + 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 @@ -77,29 +291,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,51 +317,42 @@ 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 - service_name, # type: str - app_name, # type: str - binding_name, # type: str - binding_resource, # type: "_models.BindingResource" - **kwargs # type: Any - ): - # type: (...) -> "_models.BindingResource" + resource_group_name: str, + service_name: str, + app_name: str, + binding_name: str, + binding_resource: "_models.BindingResource", + **kwargs: Any + ) -> "_models.BindingResource": cls = kwargs.pop('cls', None) # type: ClsType["_models.BindingResource"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-11-01-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._create_or_update_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - 'appName': self._serialize.url("app_name", app_name, 'str'), - 'bindingName': self._serialize.url("binding_name", binding_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + 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,18 +373,20 @@ 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 - service_name, # type: str - app_name, # type: str - binding_name, # type: str - binding_resource, # type: "_models.BindingResource" - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.BindingResource"] + resource_group_name: str, + service_name: str, + app_name: str, + binding_name: str, + binding_resource: "_models.BindingResource", + **kwargs: Any + ) -> 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 @@ -205,15 +402,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 +429,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,45 +455,35 @@ 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( self, - resource_group_name, # type: str - service_name, # type: str - app_name, # type: str - binding_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + resource_group_name: str, + service_name: str, + app_name: str, + binding_name: str, + **kwargs: Any + ) -> None: cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-11-01-preview" - accept = "application/json" - - # Construct URL - url = self._delete_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - 'appName': self._serialize.url("app_name", app_name, 'str'), - 'bindingName': self._serialize.url("binding_name", binding_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = 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,15 +496,16 @@ 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 - service_name, # type: str - app_name, # type: str - binding_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> LROPoller[None] + resource_group_name: str, + service_name: str, + app_name: str, + binding_name: str, + **kwargs: Any + ) -> LROPoller[None]: """Operation to delete a Binding. :param resource_group_name: The name of the resource group that contains the resource. You can @@ -334,15 +519,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 +545,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,51 +564,41 @@ 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( 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" + resource_group_name: str, + service_name: str, + app_name: str, + binding_name: str, + binding_resource: "_models.BindingResource", + **kwargs: Any + ) -> "_models.BindingResource": cls = kwargs.pop('cls', None) # type: ClsType["_models.BindingResource"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-11-01-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._update_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - 'appName': self._serialize.url("app_name", app_name, 'str'), - 'bindingName': self._serialize.url("binding_name", binding_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + 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,18 +616,20 @@ 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 - service_name, # type: str - app_name, # type: str - binding_name, # type: str - binding_resource, # type: "_models.BindingResource" - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.BindingResource"] + resource_group_name: str, + service_name: str, + app_name: str, + binding_name: str, + binding_resource: "_models.BindingResource", + **kwargs: Any + ) -> 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 @@ -475,15 +645,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 +672,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,16 +698,17 @@ 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 - service_name, # type: str - app_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.BindingResourceCollection"] + resource_group_name: str, + service_name: str, + app_name: str, + **kwargs: Any + ) -> 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 @@ -551,8 +719,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 +730,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 +776,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 0dbefc75ad9b..95ce53884d71 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,25 +5,183 @@ # 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 +import functools +from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union 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 - -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]] +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +JSONType = Any +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_get_request( + subscription_id: str, + resource_group_name: str, + service_name: str, + certificate_name: str, + **kwargs: Any +) -> 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: str, + resource_group_name: str, + service_name: str, + certificate_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> 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, + json=json, + content=content, + **kwargs + ) + + +def build_delete_request_initial( + subscription_id: str, + resource_group_name: str, + service_name: str, + certificate_name: str, + **kwargs: Any +) -> 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: str, + resource_group_name: str, + service_name: str, + **kwargs: Any +) -> 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 + ) class CertificatesOperations(object): """CertificatesOperations operations. @@ -47,14 +205,14 @@ def __init__(self, client, config, serializer, deserializer): 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" + 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 @@ -74,28 +232,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,49 +257,40 @@ 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 - service_name, # type: str - certificate_name, # type: str - certificate_resource, # type: "_models.CertificateResource" - **kwargs # type: Any - ): - # type: (...) -> "_models.CertificateResource" + resource_group_name: str, + service_name: str, + certificate_name: str, + certificate_resource: "_models.CertificateResource", + **kwargs: Any + ) -> "_models.CertificateResource": cls = kwargs.pop('cls', None) # type: ClsType["_models.CertificateResource"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-11-01-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._create_or_update_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - 'certificateName': self._serialize.url("certificate_name", certificate_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + 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,17 +311,19 @@ 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 - service_name, # type: str - certificate_name, # type: str - certificate_resource, # type: "_models.CertificateResource" - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.CertificateResource"] + resource_group_name: str, + service_name: str, + certificate_name: str, + certificate_resource: "_models.CertificateResource", + **kwargs: Any + ) -> LROPoller["_models.CertificateResource"]: """Create or update certificate resource. :param resource_group_name: The name of the resource group that contains the resource. You can @@ -193,18 +334,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 +364,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,43 +390,33 @@ 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( self, - resource_group_name, # type: str - service_name, # type: str - certificate_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + resource_group_name: str, + service_name: str, + certificate_name: str, + **kwargs: Any + ) -> None: cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-11-01-preview" - accept = "application/json" - - # Construct URL - url = self._delete_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - 'certificateName': self._serialize.url("certificate_name", certificate_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = 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,14 +429,15 @@ 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 - service_name, # type: str - certificate_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> LROPoller[None] + resource_group_name: str, + service_name: str, + certificate_name: str, + **kwargs: Any + ) -> LROPoller[None]: """Delete the certificate resource. :param resource_group_name: The name of the resource group that contains the resource. You can @@ -318,15 +449,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 +474,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,15 +493,16 @@ 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 - service_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.CertificateResourceCollection"] + resource_group_name: str, + service_name: str, + **kwargs: Any + ) -> 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 @@ -385,8 +511,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 +522,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 +566,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 dd9d73e3d8a5..a0f867c57608 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,24 +5,194 @@ # 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 +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 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 - -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]] +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +JSONType = Any +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_get_request( + subscription_id: str, + resource_group_name: str, + service_name: str, + **kwargs: Any +) -> 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: str, + resource_group_name: str, + service_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> 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, + json=json, + content=content, + **kwargs + ) + + +def build_update_patch_request_initial( + subscription_id: str, + resource_group_name: str, + service_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> 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, + json=json, + content=content, + **kwargs + ) + + +def build_validate_request_initial( + subscription_id: str, + resource_group_name: str, + service_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> 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, + json=json, + content=content, + **kwargs + ) class ConfigServersOperations(object): """ConfigServersOperations operations. @@ -46,13 +216,13 @@ def __init__(self, client, config, serializer, deserializer): 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" + 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 @@ -70,27 +240,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,47 +264,38 @@ 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 - service_name, # type: str - config_server_resource, # type: "_models.ConfigServerResource" - **kwargs # type: Any - ): - # type: (...) -> "_models.ConfigServerResource" + resource_group_name: str, + service_name: str, + config_server_resource: "_models.ConfigServerResource", + **kwargs: Any + ) -> "_models.ConfigServerResource": cls = kwargs.pop('cls', None) # type: ClsType["_models.ConfigServerResource"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-11-01-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._update_put_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + 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,16 +313,18 @@ 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 - service_name, # type: str - config_server_resource, # type: "_models.ConfigServerResource" - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.ConfigServerResource"] + resource_group_name: str, + service_name: str, + config_server_resource: "_models.ConfigServerResource", + **kwargs: Any + ) -> LROPoller["_models.ConfigServerResource"]: """Update the config server. :param resource_group_name: The name of the resource group that contains the resource. You can @@ -180,18 +333,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 +362,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,47 +388,37 @@ 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( self, - resource_group_name, # type: str - service_name, # type: str - config_server_resource, # type: "_models.ConfigServerResource" - **kwargs # type: Any - ): - # type: (...) -> "_models.ConfigServerResource" + resource_group_name: str, + service_name: str, + config_server_resource: "_models.ConfigServerResource", + **kwargs: Any + ) -> "_models.ConfigServerResource": cls = kwargs.pop('cls', None) # type: ClsType["_models.ConfigServerResource"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-11-01-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._update_patch_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + 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_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,16 +436,18 @@ 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 - service_name, # type: str - config_server_resource, # type: "_models.ConfigServerResource" - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.ConfigServerResource"] + resource_group_name: str, + service_name: str, + config_server_resource: "_models.ConfigServerResource", + **kwargs: Any + ) -> LROPoller["_models.ConfigServerResource"]: """Update the config server. :param resource_group_name: The name of the resource group that contains the resource. You can @@ -311,18 +456,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 +485,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,47 +511,37 @@ 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( self, - resource_group_name, # type: str - service_name, # type: str - config_server_settings, # type: "_models.ConfigServerSettings" - **kwargs # type: Any - ): - # type: (...) -> "_models.ConfigServerSettingsValidateResult" + resource_group_name: str, + service_name: str, + config_server_settings: "_models.ConfigServerSettings", + **kwargs: Any + ) -> "_models.ConfigServerSettingsValidateResult": cls = kwargs.pop('cls', None) # type: ClsType["_models.ConfigServerSettingsValidateResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-11-01-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._validate_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + 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,16 +559,18 @@ 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 - service_name, # type: str - config_server_settings, # type: "_models.ConfigServerSettings" - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.ConfigServerSettingsValidateResult"] + resource_group_name: str, + service_name: str, + config_server_settings: "_models.ConfigServerSettings", + **kwargs: Any + ) -> 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 @@ -442,18 +579,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 +608,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 +634,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 9981f525763c..bb77e3c1706a 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,25 +5,239 @@ # 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 +import functools +from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union 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 - -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]] +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +JSONType = Any +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_get_request( + subscription_id: str, + resource_group_name: str, + service_name: str, + app_name: str, + domain_name: str, + **kwargs: Any +) -> 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: str, + resource_group_name: str, + service_name: str, + app_name: str, + domain_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> 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, + json=json, + content=content, + **kwargs + ) + + +def build_delete_request_initial( + subscription_id: str, + resource_group_name: str, + service_name: str, + app_name: str, + domain_name: str, + **kwargs: Any +) -> 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: str, + resource_group_name: str, + service_name: str, + app_name: str, + domain_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> 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, + json=json, + content=content, + **kwargs + ) + + +def build_list_request( + subscription_id: str, + resource_group_name: str, + service_name: str, + app_name: str, + **kwargs: Any +) -> 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 + ) class CustomDomainsOperations(object): """CustomDomainsOperations operations. @@ -47,15 +261,15 @@ def __init__(self, client, config, serializer, deserializer): 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" + 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 @@ -77,29 +291,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,51 +317,42 @@ 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 - service_name, # type: str - app_name, # type: str - domain_name, # type: str - domain_resource, # type: "_models.CustomDomainResource" - **kwargs # type: Any - ): - # type: (...) -> "_models.CustomDomainResource" + resource_group_name: str, + service_name: str, + app_name: str, + domain_name: str, + domain_resource: "_models.CustomDomainResource", + **kwargs: Any + ) -> "_models.CustomDomainResource": cls = kwargs.pop('cls', None) # type: ClsType["_models.CustomDomainResource"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-11-01-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._create_or_update_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - 'appName': self._serialize.url("app_name", app_name, 'str'), - 'domainName': self._serialize.url("domain_name", domain_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + 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,18 +373,20 @@ 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 - service_name, # type: str - app_name, # type: str - domain_name, # type: str - domain_resource, # type: "_models.CustomDomainResource" - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.CustomDomainResource"] + resource_group_name: str, + service_name: str, + app_name: str, + domain_name: str, + domain_resource: "_models.CustomDomainResource", + **kwargs: Any + ) -> 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 @@ -205,15 +402,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 +429,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,45 +455,35 @@ 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( self, - resource_group_name, # type: str - service_name, # type: str - app_name, # type: str - domain_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + resource_group_name: str, + service_name: str, + app_name: str, + domain_name: str, + **kwargs: Any + ) -> None: cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-11-01-preview" - accept = "application/json" - - # Construct URL - url = self._delete_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - 'appName': self._serialize.url("app_name", app_name, 'str'), - 'domainName': self._serialize.url("domain_name", domain_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = 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,15 +496,16 @@ 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 - service_name, # type: str - app_name, # type: str - domain_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> LROPoller[None] + resource_group_name: str, + service_name: str, + app_name: str, + domain_name: str, + **kwargs: Any + ) -> 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 @@ -334,15 +519,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 +545,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,51 +564,41 @@ 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( 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" + resource_group_name: str, + service_name: str, + app_name: str, + domain_name: str, + domain_resource: "_models.CustomDomainResource", + **kwargs: Any + ) -> "_models.CustomDomainResource": cls = kwargs.pop('cls', None) # type: ClsType["_models.CustomDomainResource"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-11-01-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._update_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - 'appName': self._serialize.url("app_name", app_name, 'str'), - 'domainName': self._serialize.url("domain_name", domain_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + 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,18 +616,20 @@ 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 - service_name, # type: str - app_name, # type: str - domain_name, # type: str - domain_resource, # type: "_models.CustomDomainResource" - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.CustomDomainResource"] + resource_group_name: str, + service_name: str, + app_name: str, + domain_name: str, + domain_resource: "_models.CustomDomainResource", + **kwargs: Any + ) -> 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 @@ -475,15 +645,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 +672,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,16 +698,17 @@ 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 - service_name, # type: str - app_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.CustomDomainResourceCollection"] + resource_group_name: str, + service_name: str, + app_name: str, + **kwargs: Any + ) -> 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 @@ -551,8 +719,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 +730,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 +776,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 d88630d96894..1add297194a5 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,25 +5,438 @@ # 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 +import functools +from typing import Any, Callable, Dict, Generic, Iterable, List, Optional, TypeVar, Union 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 - -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]] +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +JSONType = Any +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_get_request( + subscription_id: str, + resource_group_name: str, + service_name: str, + app_name: str, + deployment_name: str, + **kwargs: Any +) -> 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: str, + resource_group_name: str, + service_name: str, + app_name: str, + deployment_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> 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, + json=json, + content=content, + **kwargs + ) + + +def build_delete_request_initial( + subscription_id: str, + resource_group_name: str, + service_name: str, + app_name: str, + deployment_name: str, + **kwargs: Any +) -> 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: str, + resource_group_name: str, + service_name: str, + app_name: str, + deployment_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> 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, + json=json, + content=content, + **kwargs + ) + + +def build_list_request( + subscription_id: str, + resource_group_name: str, + service_name: str, + app_name: str, + *, + version: Optional[List[str]] = None, + **kwargs: Any +) -> 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') + 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: str, + resource_group_name: str, + service_name: str, + *, + version: Optional[List[str]] = None, + **kwargs: Any +) -> 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}/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: str, + resource_group_name: str, + service_name: str, + app_name: str, + deployment_name: str, + **kwargs: Any +) -> 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: str, + resource_group_name: str, + service_name: str, + app_name: str, + deployment_name: str, + **kwargs: Any +) -> 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: str, + resource_group_name: str, + service_name: str, + app_name: str, + deployment_name: str, + **kwargs: Any +) -> 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: str, + resource_group_name: str, + service_name: str, + app_name: str, + deployment_name: str, + **kwargs: Any +) -> 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 + ) class DeploymentsOperations(object): """DeploymentsOperations operations. @@ -47,15 +460,15 @@ def __init__(self, client, config, serializer, deserializer): 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" + 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 @@ -77,29 +490,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,51 +516,42 @@ 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 - service_name, # type: str - app_name, # type: str - deployment_name, # type: str - deployment_resource, # type: "_models.DeploymentResource" - **kwargs # type: Any - ): - # type: (...) -> "_models.DeploymentResource" + resource_group_name: str, + service_name: str, + app_name: str, + deployment_name: str, + deployment_resource: "_models.DeploymentResource", + **kwargs: Any + ) -> "_models.DeploymentResource": cls = kwargs.pop('cls', None) # type: ClsType["_models.DeploymentResource"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-11-01-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._create_or_update_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - 'appName': self._serialize.url("app_name", app_name, 'str'), - 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + 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,18 +572,20 @@ 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 - service_name, # type: str - app_name, # type: str - deployment_name, # type: str - deployment_resource, # type: "_models.DeploymentResource" - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.DeploymentResource"] + resource_group_name: str, + service_name: str, + app_name: str, + deployment_name: str, + deployment_resource: "_models.DeploymentResource", + **kwargs: Any + ) -> 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 @@ -202,18 +598,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 +629,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,45 +655,35 @@ 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( self, - resource_group_name, # type: str - service_name, # type: str - app_name, # type: str - deployment_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + resource_group_name: str, + service_name: str, + app_name: str, + deployment_name: str, + **kwargs: Any + ) -> None: cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-11-01-preview" - accept = "application/json" - - # Construct URL - url = self._delete_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - 'appName': self._serialize.url("app_name", app_name, 'str'), - 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = 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,15 +696,16 @@ 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 - service_name, # type: str - app_name, # type: str - deployment_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> LROPoller[None] + resource_group_name: str, + service_name: str, + app_name: str, + deployment_name: str, + **kwargs: Any + ) -> LROPoller[None]: """Operation to delete a Deployment. :param resource_group_name: The name of the resource group that contains the resource. You can @@ -334,15 +719,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 +745,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,51 +764,41 @@ 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( 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" + resource_group_name: str, + service_name: str, + app_name: str, + deployment_name: str, + deployment_resource: "_models.DeploymentResource", + **kwargs: Any + ) -> "_models.DeploymentResource": cls = kwargs.pop('cls', None) # type: ClsType["_models.DeploymentResource"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-11-01-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._update_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - 'appName': self._serialize.url("app_name", app_name, 'str'), - 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(deployment_resource, 'DeploymentResource') - # 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, + 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,18 +816,20 @@ 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 - service_name, # type: str - app_name, # type: str - deployment_name, # type: str - deployment_resource, # type: "_models.DeploymentResource" - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.DeploymentResource"] + resource_group_name: str, + service_name: str, + app_name: str, + deployment_name: str, + deployment_resource: "_models.DeploymentResource", + **kwargs: Any + ) -> 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 @@ -472,18 +842,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 +873,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,17 +899,18 @@ 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 - service_name, # type: str - app_name, # type: str - version=None, # type: Optional[List[str]] - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.DeploymentResourceCollection"] + resource_group_name: str, + service_name: str, + app_name: str, + version: Optional[List[str]] = None, + **kwargs: Any + ) -> 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 @@ -554,8 +923,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 +934,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,19 +982,20 @@ 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 - service_name, # type: str - version=None, # type: Optional[List[str]] - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.DeploymentResourceCollection"] + resource_group_name: str, + service_name: str, + version: Optional[List[str]] = None, + **kwargs: Any + ) -> 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 @@ -636,8 +1006,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 +1017,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 +1063,7 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) @@ -701,41 +1071,30 @@ def get_next(next_link=None): 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 + resource_group_name: str, + service_name: str, + app_name: str, + deployment_name: str, + **kwargs: Any + ) -> None: cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-11-01-preview" - accept = "application/json" - - # Construct URL - url = self._start_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - 'appName': self._serialize.url("app_name", app_name, 'str'), - 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = 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,15 +1107,16 @@ 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 - service_name, # type: str - app_name, # type: str - deployment_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> LROPoller[None] + resource_group_name: str, + service_name: str, + app_name: str, + deployment_name: str, + **kwargs: Any + ) -> LROPoller[None]: """Start the deployment. :param resource_group_name: The name of the resource group that contains the resource. You can @@ -770,15 +1130,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 +1156,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,45 +1175,35 @@ 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( self, - resource_group_name, # type: str - service_name, # type: str - app_name, # type: str - deployment_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + resource_group_name: str, + service_name: str, + app_name: str, + deployment_name: str, + **kwargs: Any + ) -> None: cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-11-01-preview" - accept = "application/json" - - # Construct URL - url = self._stop_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - 'appName': self._serialize.url("app_name", app_name, 'str'), - 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = 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,15 +1216,16 @@ 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 - service_name, # type: str - app_name, # type: str - deployment_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> LROPoller[None] + resource_group_name: str, + service_name: str, + app_name: str, + deployment_name: str, + **kwargs: Any + ) -> LROPoller[None]: """Stop the deployment. :param resource_group_name: The name of the resource group that contains the resource. You can @@ -895,15 +1239,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 +1265,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,45 +1284,35 @@ 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( self, - resource_group_name, # type: str - service_name, # type: str - app_name, # type: str - deployment_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + resource_group_name: str, + service_name: str, + app_name: str, + deployment_name: str, + **kwargs: Any + ) -> None: cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-11-01-preview" - accept = "application/json" - - # Construct URL - url = self._restart_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - 'appName': self._serialize.url("app_name", app_name, 'str'), - 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = 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,15 +1325,16 @@ 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 - service_name, # type: str - app_name, # type: str - deployment_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> LROPoller[None] + resource_group_name: str, + service_name: str, + app_name: str, + deployment_name: str, + **kwargs: Any + ) -> LROPoller[None]: """Restart the deployment. :param resource_group_name: The name of the resource group that contains the resource. You can @@ -1020,15 +1348,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 +1374,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,17 +1393,18 @@ 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 - service_name, # type: str - app_name, # type: str - deployment_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> Optional["_models.LogFileUrlResponse"] + 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 @@ -1104,29 +1426,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 +1454,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 a7544e77b785..a1a30ae340c0 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,24 +5,150 @@ # 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 +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 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 - -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]] +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +JSONType = Any +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_get_request( + subscription_id: str, + resource_group_name: str, + service_name: str, + **kwargs: Any +) -> 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: str, + resource_group_name: str, + service_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> 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, + json=json, + content=content, + **kwargs + ) + + +def build_update_patch_request_initial( + subscription_id: str, + resource_group_name: str, + service_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> 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, + json=json, + content=content, + **kwargs + ) class MonitoringSettingsOperations(object): """MonitoringSettingsOperations operations. @@ -46,13 +172,13 @@ def __init__(self, client, config, serializer, deserializer): 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" + 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 @@ -70,27 +196,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,47 +220,38 @@ 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 - service_name, # type: str - monitoring_setting_resource, # type: "_models.MonitoringSettingResource" - **kwargs # type: Any - ): - # type: (...) -> "_models.MonitoringSettingResource" + resource_group_name: str, + service_name: str, + monitoring_setting_resource: "_models.MonitoringSettingResource", + **kwargs: Any + ) -> "_models.MonitoringSettingResource": cls = kwargs.pop('cls', None) # type: ClsType["_models.MonitoringSettingResource"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-11-01-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._update_put_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(monitoring_setting_resource, 'MonitoringSettingResource') - # 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_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,16 +269,18 @@ 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 - service_name, # type: str - monitoring_setting_resource, # type: "_models.MonitoringSettingResource" - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.MonitoringSettingResource"] + resource_group_name: str, + service_name: str, + monitoring_setting_resource: "_models.MonitoringSettingResource", + **kwargs: Any + ) -> LROPoller["_models.MonitoringSettingResource"]: """Update the Monitoring Setting. :param resource_group_name: The name of the resource group that contains the resource. You can @@ -180,18 +289,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 +318,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,47 +344,37 @@ 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( self, - resource_group_name, # type: str - service_name, # type: str - monitoring_setting_resource, # type: "_models.MonitoringSettingResource" - **kwargs # type: Any - ): - # type: (...) -> "_models.MonitoringSettingResource" + resource_group_name: str, + service_name: str, + monitoring_setting_resource: "_models.MonitoringSettingResource", + **kwargs: Any + ) -> "_models.MonitoringSettingResource": cls = kwargs.pop('cls', None) # type: ClsType["_models.MonitoringSettingResource"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-11-01-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._update_patch_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + 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,16 +392,18 @@ 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 - service_name, # type: str - monitoring_setting_resource, # type: "_models.MonitoringSettingResource" - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.MonitoringSettingResource"] + resource_group_name: str, + service_name: str, + monitoring_setting_resource: "_models.MonitoringSettingResource", + **kwargs: Any + ) -> LROPoller["_models.MonitoringSettingResource"]: """Update the Monitoring Setting. :param resource_group_name: The name of the resource group that contains the resource. You can @@ -311,18 +412,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 +441,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 +467,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 e93fd2c14107..5b13065e25de 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,23 +5,50 @@ # 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 +import functools +from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar 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 - -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]] +from .._vendor import _convert_request +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_list_request( + **kwargs: Any +) -> 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 + ) class Operations(object): """Operations operations. @@ -45,16 +72,17 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def list( self, - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.AvailableOperations"] + **kwargs: Any + ) -> Iterable["_models.AvailableOperations"]: """Lists all of the available REST API operations of the Microsoft.AppPlatform provider. :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either AvailableOperations or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2020_11_01_preview.models.AvailableOperations] + :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 +90,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 +128,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 5c7e5ce3dc27..493ec2dd8498 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,22 +5,49 @@ # 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 +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 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 - -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]] +from .._vendor import _convert_request +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_list_runtime_versions_request( + **kwargs: Any +) -> 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 + ) class RuntimeVersionsOperations(object): """RuntimeVersionsOperations operations. @@ -44,11 +71,11 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def list_runtime_versions( self, - **kwargs # type: Any - ): - # type: (...) -> "_models.AvailableRuntimeVersions" + **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 @@ -61,21 +88,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') + + 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) - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -89,4 +109,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 2aa4b23d010b..cfd11e917854 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,25 +5,441 @@ # 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 +import functools +from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union 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 - -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]] +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +JSONType = Any +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_get_request( + subscription_id: str, + resource_group_name: str, + service_name: str, + **kwargs: Any +) -> 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: str, + resource_group_name: str, + service_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> 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, + json=json, + content=content, + **kwargs + ) + + +def build_delete_request_initial( + subscription_id: str, + resource_group_name: str, + service_name: str, + **kwargs: Any +) -> 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: str, + resource_group_name: str, + service_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> 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, + json=json, + content=content, + **kwargs + ) + + +def build_list_test_keys_request( + subscription_id: str, + resource_group_name: str, + service_name: str, + **kwargs: Any +) -> 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: str, + resource_group_name: str, + service_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> 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, + json=json, + content=content, + **kwargs + ) + + +def build_disable_test_endpoint_request( + subscription_id: str, + resource_group_name: str, + service_name: str, + **kwargs: Any +) -> 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: str, + resource_group_name: str, + service_name: str, + **kwargs: Any +) -> 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: str, + location: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> 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, + json=json, + content=content, + **kwargs + ) + + +def build_list_by_subscription_request( + subscription_id: str, + **kwargs: Any +) -> 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: str, + resource_group_name: str, + **kwargs: Any +) -> 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 + ) class ServicesOperations(object): """ServicesOperations operations. @@ -47,13 +463,13 @@ def __init__(self, client, config, serializer, deserializer): 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" + 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 @@ -71,27 +487,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,47 +511,38 @@ 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 - service_name, # type: str - resource, # type: "_models.ServiceResource" - **kwargs # type: Any - ): - # type: (...) -> "_models.ServiceResource" + resource_group_name: str, + service_name: str, + resource: "_models.ServiceResource", + **kwargs: Any + ) -> "_models.ServiceResource": cls = kwargs.pop('cls', None) # type: ClsType["_models.ServiceResource"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-11-01-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._create_or_update_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(resource, 'ServiceResource') - # 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, + 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,16 +563,18 @@ 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 - service_name, # type: str - resource, # type: "_models.ServiceResource" - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.ServiceResource"] + resource_group_name: str, + service_name: str, + resource: "_models.ServiceResource", + **kwargs: Any + ) -> 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 @@ -187,15 +586,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 +611,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,41 +637,31 @@ 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( self, - resource_group_name, # type: str - service_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + resource_group_name: str, + service_name: str, + **kwargs: Any + ) -> None: cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-11-01-preview" - accept = "application/json" - - # Construct URL - url = self._delete_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = 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,13 +674,14 @@ 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 - service_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> LROPoller[None] + resource_group_name: str, + service_name: str, + **kwargs: Any + ) -> LROPoller[None]: """Operation to delete a Service. :param resource_group_name: The name of the resource group that contains the resource. You can @@ -302,15 +691,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 +715,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,47 +734,37 @@ 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( self, - resource_group_name, # type: str - service_name, # type: str - resource, # type: "_models.ServiceResource" - **kwargs # type: Any - ): - # type: (...) -> "_models.ServiceResource" + resource_group_name: str, + service_name: str, + resource: "_models.ServiceResource", + **kwargs: Any + ) -> "_models.ServiceResource": cls = kwargs.pop('cls', None) # type: ClsType["_models.ServiceResource"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-11-01-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._update_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + 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,16 +782,18 @@ 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 - service_name, # type: str - resource, # type: "_models.ServiceResource" - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.ServiceResource"] + resource_group_name: str, + service_name: str, + resource: "_models.ServiceResource", + **kwargs: Any + ) -> 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 @@ -429,15 +805,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 +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: @@ -481,15 +856,16 @@ 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 - service_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.TestKeys" + 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 @@ -507,27 +883,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,16 +907,18 @@ 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 - service_name, # type: str - regenerate_test_key_request, # type: "_models.RegenerateTestKeyRequestPayload" - **kwargs # type: Any - ): - # type: (...) -> "_models.TestKeys" + 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 @@ -559,7 +927,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 +939,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,15 +968,17 @@ 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 - service_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + 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 @@ -635,27 +996,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,13 +1019,14 @@ 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 - service_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.TestKeys" + 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 @@ -692,27 +1044,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,21 +1068,24 @@ 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 - availability_parameters, # type: "_models.NameAvailabilityParameters" - **kwargs # type: Any - ): - # type: (...) -> "_models.NameAvailability" + location: str, + availability_parameters: "_models.NameAvailabilityParameters", + **kwargs: Any + ) -> "_models.NameAvailability": """Checks that the resource name is valid and is not already in use. :param location: the region. :type location: str :param availability_parameters: Parameters supplied to the operation. - :type availability_parameters: ~azure.mgmt.appplatform.v2020_11_01_preview.models.NameAvailabilityParameters + :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 +1096,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,18 +1124,21 @@ 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 - ): - # type: (...) -> Iterable["_models.ServiceResourceList"] + **kwargs: Any + ) -> 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.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 +1146,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,17 +1186,18 @@ 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 - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.ServiceResourceList"] + resource_group_name: str, + **kwargs: Any + ) -> 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 @@ -871,7 +1205,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 +1214,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 +1256,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 746347c182fa..6d437ebb19fa 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,23 +5,56 @@ # 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 +import functools +from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar 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 - -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]] +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_list_request( + subscription_id: str, + **kwargs: Any +) -> 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 + ) class SkusOperations(object): """SkusOperations operations. @@ -45,16 +78,18 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def list( self, - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.ResourceSkuCollection"] + **kwargs: Any + ) -> 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.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 +97,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 +137,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 d2ddf950056a..41ec6d71ff7f 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 7deee559a538..24f6199816f9 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,124 +6,115 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING +from copy import deepcopy +from typing import Any, Optional, TYPE_CHECKING +from azure.core.rest import HttpRequest, HttpResponse 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 - -class AppPlatformManagementClient(object): +class AppPlatformManagementClient: """REST API for Azure Spring Cloud. :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] - **kwargs # type: Any - ): - # type: (...) -> None - if not base_url: - base_url = 'https://management.azure.com' - self._config = AppPlatformManagementClientConfiguration(credential, subscription_id, **kwargs) + credential: "TokenCredential", + 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 = 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: Any + ) -> HttpResponse: """Runs the network request through the client's chained policies. - :param http_request: The network request you want to make. Required. - :type http_request: ~azure.core.pipeline.transport.HttpRequest - :keyword bool stream: Whether the response payload will be streamed. Defaults to True. + >>> 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 a358948766fb..47f8ba0a61ff 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 @@ -6,18 +6,16 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING +from typing import Any, TYPE_CHECKING from azure.core.configuration import Configuration from azure.core.pipeline import policies -from azure.mgmt.core.policies import ARMHttpLoggingPolicy +from 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 @@ -35,16 +33,15 @@ class AppPlatformManagementClientConfiguration(Configuration): def __init__( self, - credential, # type: "TokenCredential" - subscription_id, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + credential: "TokenCredential", + 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 @@ -68,4 +65,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 c8bb068cd9a7..a3132cd2e192 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 000000000000..74e48ecd07cf --- /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 000000000000..138f663c53a4 --- /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/aio/__init__.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2021_06_01_preview/aio/__init__.py index 39f105488735..44ce4a5043f8 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 dfc7ace8ede5..1a52c8cbaff5 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 80c22c56c44f..c08c3df917cf 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 000000000000..74e48ecd07cf --- /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 4de955a71684..e206946240b6 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 b4572f289daf..d883af9dff03 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 60ac54d76077..95f48721f56c 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 b032bebe43dc..11bafa078b78 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 4c1b197d9f5d..30a3a789403d 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 ef6fc17c694d..f402fcb7071c 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 49ecf2833cd8..1fd084c42545 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 8ccd1eee431e..19b27ba4a9cf 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 1b2936a30aac..63f96bc12d3f 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 a7d0539bc531..7a477834ae21 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 8ed38802659b..18e8dbf1ba0d 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 4fcc9dd5cc61..63bc9d3ed371 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 @@ -6,154 +6,82 @@ # 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 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 CustomContainer - from ._models_py3 import CustomDomainProperties - from ._models_py3 import CustomDomainResource - from ._models_py3 import CustomDomainResourceCollection - from ._models_py3 import CustomDomainValidatePayload - from ._models_py3 import CustomDomainValidateResult - from ._models_py3 import DeploymentInstance - from ._models_py3 import DeploymentResource - from ._models_py3 import DeploymentResourceCollection - from ._models_py3 import DeploymentResourceProperties - from ._models_py3 import DeploymentSettings - from ._models_py3 import Error - from ._models_py3 import GitPatternRepository - from ._models_py3 import ImageRegistryCredential - from ._models_py3 import LogFileUrlResponse - from ._models_py3 import LogSpecification - from ._models_py3 import ManagedIdentityProperties - 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 SupportedRuntimeVersion - 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 BindingResource # type: ignore - from ._models import BindingResourceCollection # type: ignore - from ._models import BindingResourceProperties # type: ignore - from ._models import CertificateProperties # type: ignore - from ._models import CertificateResource # type: ignore - from ._models import CertificateResourceCollection # type: ignore - from ._models import CloudErrorBody # type: ignore - from ._models import ClusterResourceProperties # type: ignore - from ._models import ConfigServerGitProperty # type: ignore - from ._models import ConfigServerProperties # type: ignore - from ._models import ConfigServerResource # type: ignore - from ._models import ConfigServerSettings # type: ignore - from ._models import ConfigServerSettingsErrorRecord # type: ignore - from ._models import ConfigServerSettingsValidateResult # type: ignore - from ._models import CustomContainer # type: ignore - from ._models import CustomDomainProperties # type: ignore - from ._models import CustomDomainResource # type: ignore - from ._models import CustomDomainResourceCollection # type: ignore - from ._models import CustomDomainValidatePayload # type: ignore - from ._models import CustomDomainValidateResult # type: ignore - from ._models import DeploymentInstance # type: ignore - from ._models import DeploymentResource # type: ignore - from ._models import DeploymentResourceCollection # type: ignore - from ._models import DeploymentResourceProperties # type: ignore - from ._models import DeploymentSettings # type: ignore - from ._models import Error # type: ignore - from ._models import GitPatternRepository # type: ignore - from ._models import ImageRegistryCredential # type: ignore - from ._models import LogFileUrlResponse # type: ignore - from ._models import LogSpecification # type: ignore - from ._models import ManagedIdentityProperties # type: ignore - from ._models import MetricDimension # type: ignore - from ._models import MetricSpecification # type: ignore - from ._models import MonitoringSettingProperties # type: ignore - from ._models import MonitoringSettingResource # type: ignore - from ._models import NameAvailability # type: ignore - from ._models import NameAvailabilityParameters # type: ignore - from ._models import NetworkProfile # type: ignore - from ._models import NetworkProfileOutboundIPs # type: ignore - from ._models import OperationDetail # type: ignore - from ._models import OperationDisplay # type: ignore - from ._models import OperationProperties # type: ignore - from ._models import PersistentDisk # type: ignore - from ._models import ProxyResource # type: ignore - from ._models import RegenerateTestKeyRequestPayload # type: ignore - from ._models import RequiredTraffic # type: ignore - from ._models import Resource # type: ignore - from ._models import ResourceRequests # type: ignore - from ._models import ResourceSku # type: ignore - from ._models import ResourceSkuCapabilities # type: ignore - from ._models import ResourceSkuCollection # type: ignore - from ._models import ResourceSkuLocationInfo # type: ignore - from ._models import ResourceSkuRestrictionInfo # type: ignore - from ._models import ResourceSkuRestrictions # type: ignore - from ._models import ResourceSkuZoneDetails # type: ignore - from ._models import ResourceUploadDefinition # type: ignore - from ._models import ServiceResource # type: ignore - from ._models import ServiceResourceList # type: ignore - from ._models import ServiceSpecification # type: ignore - from ._models import Sku # type: ignore - from ._models import SkuCapacity # type: ignore - from ._models import SupportedRuntimeVersion # type: ignore - from ._models import TemporaryDisk # type: ignore - from ._models import TestKeys # type: ignore - from ._models import TrackedResource # type: ignore - from ._models import UserSourceInfo # type: ignore +from ._models_py3 import AppResource +from ._models_py3 import AppResourceCollection +from ._models_py3 import AppResourceProperties +from ._models_py3 import ApplicationInsightsAgentVersions +from ._models_py3 import AvailableOperations +from ._models_py3 import AvailableRuntimeVersions +from ._models_py3 import BindingResource +from ._models_py3 import BindingResourceCollection +from ._models_py3 import BindingResourceProperties +from ._models_py3 import CertificateProperties +from ._models_py3 import CertificateResource +from ._models_py3 import CertificateResourceCollection +from ._models_py3 import CloudErrorBody +from ._models_py3 import ClusterResourceProperties +from ._models_py3 import ConfigServerGitProperty +from ._models_py3 import ConfigServerProperties +from ._models_py3 import ConfigServerResource +from ._models_py3 import ConfigServerSettings +from ._models_py3 import ConfigServerSettingsErrorRecord +from ._models_py3 import ConfigServerSettingsValidateResult +from ._models_py3 import CustomContainer +from ._models_py3 import CustomDomainProperties +from ._models_py3 import CustomDomainResource +from ._models_py3 import CustomDomainResourceCollection +from ._models_py3 import CustomDomainValidatePayload +from ._models_py3 import CustomDomainValidateResult +from ._models_py3 import DeploymentInstance +from ._models_py3 import DeploymentResource +from ._models_py3 import DeploymentResourceCollection +from ._models_py3 import DeploymentResourceProperties +from ._models_py3 import DeploymentSettings +from ._models_py3 import Error +from ._models_py3 import GitPatternRepository +from ._models_py3 import ImageRegistryCredential +from ._models_py3 import LogFileUrlResponse +from ._models_py3 import LogSpecification +from ._models_py3 import ManagedIdentityProperties +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 SupportedRuntimeVersion +from ._models_py3 import TemporaryDisk +from ._models_py3 import TestKeys +from ._models_py3 import TrackedResource +from ._models_py3 import UserSourceInfo + from ._app_platform_management_client_enums import ( + ActionType, AppResourceProvisioningState, ConfigServerState, DeploymentResourceProvisioningState, @@ -245,6 +173,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 aa047f451ec5..fa72f83379ee 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 deleted file mode 100644 index 0fff45f07e4a..000000000000 --- a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2021_06_01_preview/models/_models.py +++ /dev/null @@ -1,2501 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -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 - :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 - """ - - _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 - ): - 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. - - :param value: Collection of App resources. - :type value: list[~azure.mgmt.appplatform.v2021_06_01_preview.models.AppResource] - :param next_link: URL client should use to fetch the next page (per server side paging). - It's null for now, added for future use. - :type next_link: str - """ - - _attribute_map = { - 'value': {'key': 'value', 'type': '[AppResource]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(AppResourceCollection, self).__init__(**kwargs) - self.value = kwargs.get('value', None) - self.next_link = kwargs.get('next_link', None) - - -class AppResourceProperties(msrest.serialization.Model): - """App resource properties payload. - - Variables are only populated by the server, and will be ignored when sending a request. - - :param public: Indicates whether the App exposes public endpoint. - :type 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 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 - """ - - _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'}, - 'enable_end_to_end_tls': {'key': 'enableEndToEndTLS', 'type': 'bool'}, - } - - def __init__( - self, - **kwargs - ): - super(AppResourceProperties, self).__init__(**kwargs) - self.public = kwargs.get('public', None) - self.url = None - self.provisioning_state = None - self.active_deployment_name = kwargs.get('active_deployment_name', None) - self.fqdn = kwargs.get('fqdn', None) - self.https_only = kwargs.get('https_only', None) - self.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) - - -class AvailableOperations(msrest.serialization.Model): - """Available operations of the service. - - :param value: Collection of available operation details. - :type value: list[~azure.mgmt.appplatform.v2021_06_01_preview.models.OperationDetail] - :param next_link: URL client should use to fetch the next page (per server side paging). - It's null for now, added for future use. - :type next_link: str - """ - - _attribute_map = { - 'value': {'key': 'value', 'type': '[OperationDetail]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(AvailableOperations, self).__init__(**kwargs) - self.value = kwargs.get('value', None) - self.next_link = kwargs.get('next_link', None) - - -class AvailableRuntimeVersions(msrest.serialization.Model): - """AvailableRuntimeVersions. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar value: A list of all supported runtime versions. - :vartype value: - list[~azure.mgmt.appplatform.v2021_06_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 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 - :param properties: Properties of the Binding resource. - :type properties: ~azure.mgmt.appplatform.v2021_06_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 - ): - 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. - - :param value: Collection of Binding resources. - :type value: list[~azure.mgmt.appplatform.v2021_06_01_preview.models.BindingResource] - :param next_link: URL client should use to fetch the next page (per server side paging). - It's null for now, added for future use. - :type next_link: str - """ - - _attribute_map = { - 'value': {'key': 'value', 'type': '[BindingResource]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(BindingResourceCollection, self).__init__(**kwargs) - self.value = kwargs.get('value', None) - self.next_link = kwargs.get('next_link', None) - - -class BindingResourceProperties(msrest.serialization.Model): - """Binding resource properties payload. - - Variables are only populated by the server, and will be ignored when sending a request. - - :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 - :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 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 - ): - 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. - - 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 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 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 = { - 'thumbprint': {'readonly': True}, - 'vault_uri': {'required': True}, - 'key_vault_cert_name': {'required': 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 = { - 'thumbprint': {'key': 'thumbprint', 'type': 'str'}, - 'vault_uri': {'key': 'vaultUri', 'type': 'str'}, - 'key_vault_cert_name': {'key': 'keyVaultCertName', 'type': 'str'}, - 'cert_version': {'key': 'certVersion', '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]'}, - } - - def __init__( - self, - **kwargs - ): - super(CertificateProperties, self).__init__(**kwargs) - self.thumbprint = None - self.vault_uri = kwargs['vault_uri'] - self.key_vault_cert_name = kwargs['key_vault_cert_name'] - self.cert_version = kwargs.get('cert_version', None) - self.issuer = None - self.issued_date = None - 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 - :param properties: Properties of the certificate resource payload. - :type properties: ~azure.mgmt.appplatform.v2021_06_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 - ): - 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. - - :param value: The certificate resources list. - :type value: list[~azure.mgmt.appplatform.v2021_06_01_preview.models.CertificateResource] - :param next_link: The link to next page of certificate list. - :type next_link: str - """ - - _attribute_map = { - 'value': {'key': 'value', 'type': '[CertificateResource]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(CertificateResourceCollection, self).__init__(**kwargs) - self.value = kwargs.get('value', None) - self.next_link = kwargs.get('next_link', None) - - -class CloudErrorBody(msrest.serialization.Model): - """An error response from the service. - - :param code: An identifier for the error. Codes are invariant and are intended to be consumed - programmatically. - :type code: str - :param message: A message describing the error, intended to be suitable for display in a user - interface. - :type message: str - :param target: The target of the particular error. For example, the name of the property in - error. - :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] - """ - - _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 - ): - 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_06_01_preview.models.ProvisioningState - :param network_profile: Network profile of the Service. - :type network_profile: ~azure.mgmt.appplatform.v2021_06_01_preview.models.NetworkProfile - :ivar version: Version of the Service. - :vartype version: int - :ivar service_id: ServiceInstanceEntity GUID which uniquely identifies a created resource. - :vartype service_id: str - """ - - _validation = { - 'provisioning_state': {'readonly': True}, - 'version': {'readonly': True}, - 'service_id': {'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'}, - } - - def __init__( - self, - **kwargs - ): - super(ClusterResourceProperties, self).__init__(**kwargs) - self.provisioning_state = None - self.network_profile = kwargs.get('network_profile', None) - self.version = None - self.service_id = None - - -class ConfigServerGitProperty(msrest.serialization.Model): - """Property of git. - - All required parameters must be populated in order to send to Azure. - - :param repositories: Repositories of git. - :type repositories: - list[~azure.mgmt.appplatform.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 - """ - - _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 - ): - 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_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 - """ - - _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 - ): - 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 - :param properties: Properties of the Config Server resource. - :type properties: ~azure.mgmt.appplatform.v2021_06_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 - ): - super(ConfigServerResource, self).__init__(**kwargs) - self.properties = kwargs.get('properties', None) - - -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 - """ - - _attribute_map = { - 'git_property': {'key': 'gitProperty', 'type': 'ConfigServerGitProperty'}, - } - - def __init__( - self, - **kwargs - ): - 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. - - :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] - """ - - _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'uri': {'key': 'uri', 'type': 'str'}, - 'messages': {'key': 'messages', 'type': '[str]'}, - } - - def __init__( - self, - **kwargs - ): - super(ConfigServerSettingsErrorRecord, self).__init__(**kwargs) - self.name = kwargs.get('name', None) - self.uri = kwargs.get('uri', None) - self.messages = kwargs.get('messages', None) - - -class ConfigServerSettingsValidateResult(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.v2021_06_01_preview.models.ConfigServerSettingsErrorRecord] - """ - - _attribute_map = { - 'is_valid': {'key': 'isValid', 'type': 'bool'}, - 'details': {'key': 'details', 'type': '[ConfigServerSettingsErrorRecord]'}, - } - - def __init__( - self, - **kwargs - ): - super(ConfigServerSettingsValidateResult, self).__init__(**kwargs) - self.is_valid = kwargs.get('is_valid', None) - self.details = kwargs.get('details', None) - - -class CustomContainer(msrest.serialization.Model): - """Custom container payload. - - :param server: The name of the registry that contains the container image. - :type server: str - :param container_image: Container image of the custom container. This should be in the form of - :code:``::code:`` without the server name of the registry. - :type container_image: str - :param command: Entrypoint array. Not executed within a shell. The docker image's ENTRYPOINT is - used if this is not provided. - :type command: list[str] - :param args: Arguments to the entrypoint. The docker image's CMD is used if this is not - provided. - :type args: list[str] - :param image_registry_credential: Credential of the image registry. - :type image_registry_credential: - ~azure.mgmt.appplatform.v2021_06_01_preview.models.ImageRegistryCredential - """ - - _attribute_map = { - 'server': {'key': 'server', 'type': 'str'}, - 'container_image': {'key': 'containerImage', 'type': 'str'}, - 'command': {'key': 'command', 'type': '[str]'}, - 'args': {'key': 'args', 'type': '[str]'}, - 'image_registry_credential': {'key': 'imageRegistryCredential', 'type': 'ImageRegistryCredential'}, - } - - def __init__( - self, - **kwargs - ): - super(CustomContainer, self).__init__(**kwargs) - self.server = kwargs.get('server', None) - self.container_image = kwargs.get('container_image', None) - self.command = kwargs.get('command', None) - self.args = kwargs.get('args', None) - self.image_registry_credential = kwargs.get('image_registry_credential', None) - - -class CustomDomainProperties(msrest.serialization.Model): - """Custom domain of app resource payload. - - Variables are only populated by the server, and will be ignored when sending a request. - - :param thumbprint: The thumbprint of bound certificate. - :type 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 - """ - - _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 - ): - 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 - :param properties: Properties of the custom domain resource. - :type properties: ~azure.mgmt.appplatform.v2021_06_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 - ): - 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. - - :param value: The custom domain resources list. - :type value: list[~azure.mgmt.appplatform.v2021_06_01_preview.models.CustomDomainResource] - :param next_link: The link to next page of custom domain list. - :type next_link: str - """ - - _attribute_map = { - 'value': {'key': 'value', 'type': '[CustomDomainResource]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(CustomDomainResourceCollection, self).__init__(**kwargs) - self.value = kwargs.get('value', None) - self.next_link = kwargs.get('next_link', None) - - -class CustomDomainValidatePayload(msrest.serialization.Model): - """Custom domain validate payload. - - All required parameters must be populated in order to send to Azure. - - :param name: Required. Name to be validated. - :type name: str - """ - - _validation = { - 'name': {'required': True}, - } - - _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(CustomDomainValidatePayload, self).__init__(**kwargs) - self.name = kwargs['name'] - - -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 - """ - - _attribute_map = { - 'is_valid': {'key': 'isValid', 'type': 'bool'}, - 'message': {'key': 'message', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(CustomDomainValidateResult, self).__init__(**kwargs) - self.is_valid = kwargs.get('is_valid', None) - self.message = kwargs.get('message', None) - - -class DeploymentInstance(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 - :param properties: Properties of the Deployment resource. - :type properties: - ~azure.mgmt.appplatform.v2021_06_01_preview.models.DeploymentResourceProperties - :param sku: Sku of the Deployment resource. - :type sku: ~azure.mgmt.appplatform.v2021_06_01_preview.models.Sku - """ - - _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 - ): - 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. - - :param value: Collection of Deployment resources. - :type value: list[~azure.mgmt.appplatform.v2021_06_01_preview.models.DeploymentResource] - :param next_link: URL client should use to fetch the next page (per server side paging). - It's null for now, added for future use. - :type next_link: str - """ - - _attribute_map = { - 'value': {'key': 'value', 'type': '[DeploymentResource]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(DeploymentResourceCollection, self).__init__(**kwargs) - self.value = kwargs.get('value', None) - self.next_link = kwargs.get('next_link', None) - - -class DeploymentResourceProperties(msrest.serialization.Model): - """Deployment resource properties payload. - - Variables are only populated by the server, and will be ignored when sending a request. - - :param source: Uploaded source information of the deployment. - :type source: ~azure.mgmt.appplatform.v2021_06_01_preview.models.UserSourceInfo - :ivar app_name: App name of the deployment. - :vartype app_name: str - :param deployment_settings: Deployment settings of the Deployment. - :type deployment_settings: - ~azure.mgmt.appplatform.v2021_06_01_preview.models.DeploymentSettings - :ivar provisioning_state: Provisioning state of the Deployment. Possible values include: - "Creating", "Updating", "Succeeded", "Failed". - :vartype provisioning_state: str or - ~azure.mgmt.appplatform.v2021_06_01_preview.models.DeploymentResourceProvisioningState - :ivar status: Status of the Deployment. Possible values include: "Unknown", "Stopped", - "Running", "Failed", "Allocating", "Upgrading", "Compiling". - :vartype status: str or - ~azure.mgmt.appplatform.v2021_06_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_06_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 - ): - 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. - - :param cpu: Required CPU. This should be 1 for Basic tier, and in range [1, 4] for Standard - tier. This is deprecated starting from API version 2021-06-01-preview. Please use the - resourceRequests field to set the CPU size. - :type cpu: int - :param memory_in_gb: Required Memory size in GB. This should be in range [1, 2] for Basic tier, - and in range [1, 8] for Standard tier. This is deprecated starting from API version - 2021-06-01-preview. Please use the resourceRequests field to set the the memory size. - :type memory_in_gb: int - :param resource_requests: The requested resource quantity for required CPU and Memory. It is - recommended that using this field to represent the required CPU and Memory, the old field cpu - and memoryInGB will be deprecated later. - :type resource_requests: ~azure.mgmt.appplatform.v2021_06_01_preview.models.ResourceRequests - :param jvm_options: JVM parameter. - :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 - """ - - _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'}, - } - - def __init__( - self, - **kwargs - ): - super(DeploymentSettings, self).__init__(**kwargs) - self.cpu = kwargs.get('cpu', 1) - self.memory_in_gb = kwargs.get('memory_in_gb', 1) - self.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', None) - - -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 - """ - - _attribute_map = { - 'code': {'key': 'code', 'type': 'str'}, - 'message': {'key': 'message', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - 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. - - :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 - """ - - _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 - ): - 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. - - :param username: The username of the image registry credential. - :type username: str - :param password: The password of the image registry credential. - :type password: str - """ - - _attribute_map = { - 'username': {'key': 'username', 'type': 'str'}, - 'password': {'key': 'password', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(ImageRegistryCredential, self).__init__(**kwargs) - self.username = kwargs.get('username', None) - self.password = kwargs.get('password', None) - - -class LogFileUrlResponse(msrest.serialization.Model): - """Log file URL payload. - - All required parameters must be populated in order to send to Azure. - - :param url: Required. URL of the log file. - :type url: str - """ - - _validation = { - 'url': {'required': True}, - } - - _attribute_map = { - 'url': {'key': 'url', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(LogFileUrlResponse, self).__init__(**kwargs) - self.url = kwargs['url'] - - -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 - """ - - _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'display_name': {'key': 'displayName', 'type': 'str'}, - 'blob_duration': {'key': 'blobDuration', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(LogSpecification, self).__init__(**kwargs) - self.name = kwargs.get('name', None) - self.display_name = kwargs.get('display_name', None) - self.blob_duration = kwargs.get('blob_duration', None) - - -class ManagedIdentityProperties(msrest.serialization.Model): - """Managed identity properties retrieved from ARM request headers. - - :param type: Type of the managed identity. Possible values include: "None", "SystemAssigned", - "UserAssigned", "SystemAssigned,UserAssigned". - :type type: str or ~azure.mgmt.appplatform.v2021_06_01_preview.models.ManagedIdentityType - :param principal_id: Principal Id. - :type principal_id: str - :param tenant_id: Tenant Id. - :type 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 - ): - 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. - - :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 - export scenario. - :type to_be_exported_for_shoebox: bool - """ - - _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'display_name': {'key': 'displayName', 'type': 'str'}, - 'to_be_exported_for_shoebox': {'key': 'toBeExportedForShoebox', 'type': 'bool'}, - } - - def __init__( - self, - **kwargs - ): - 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. - - :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 - belong to a single category. - :type category: str - :param aggregation_type: Only provide one value for this field. Valid values: Average, Minimum, - Maximum, Total, Count. - :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 - 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] - """ - - _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]'}, - } - - def __init__( - self, - **kwargs - ): - 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) - - -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_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, - 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: - ~azure.mgmt.appplatform.v2021_06_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 - ): - 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 - :param properties: Properties of the Monitoring Setting resource. - :type properties: - ~azure.mgmt.appplatform.v2021_06_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 - ): - super(MonitoringSettingResource, self).__init__(**kwargs) - self.properties = kwargs.get('properties', 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 - """ - - _attribute_map = { - 'name_available': {'key': 'nameAvailable', 'type': 'bool'}, - 'reason': {'key': 'reason', 'type': 'str'}, - 'message': {'key': 'message', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(NameAvailability, self).__init__(**kwargs) - self.name_available = kwargs.get('name_available', None) - self.reason = kwargs.get('reason', None) - self.message = kwargs.get('message', None) - - -class NameAvailabilityParameters(msrest.serialization.Model): - """Name availability parameters payload. - - All required parameters must be populated in order to send to Azure. - - :param type: Required. Type of the resource to check name availability. - :type type: str - :param name: Required. Name to be checked. - :type 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 - ): - 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. - - :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 - resources of Azure Spring Cloud Service Runtime. - :type service_runtime_network_resource_group: str - :param app_network_resource_group: Name of the resource group containing network resources of - Azure Spring Cloud Apps. - :type 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 - :ivar required_traffics: Required inbound or outbound traffics for Azure Spring Cloud instance. - :vartype required_traffics: - list[~azure.mgmt.appplatform.v2021_06_01_preview.models.RequiredTraffic] - """ - - _validation = { - 'outbound_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 - ): - 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. - - :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 - """ - - _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'is_data_action': {'key': 'isDataAction', 'type': 'bool'}, - 'display': {'key': 'display', 'type': 'OperationDisplay'}, - 'origin': {'key': 'origin', 'type': 'str'}, - 'properties': {'key': 'properties', 'type': 'OperationProperties'}, - } - - def __init__( - self, - **kwargs - ): - super(OperationDetail, self).__init__(**kwargs) - self.name = kwargs.get('name', None) - self.is_data_action = kwargs.get('is_data_action', None) - self.display = kwargs.get('display', None) - self.origin = kwargs.get('origin', None) - self.properties = kwargs.get('properties', None) - - -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 - """ - - _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 - ): - 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. - - :param service_specification: Service specifications of the operation. - :type service_specification: - ~azure.mgmt.appplatform.v2021_06_01_preview.models.ServiceSpecification - """ - - _attribute_map = { - 'service_specification': {'key': 'serviceSpecification', 'type': 'ServiceSpecification'}, - } - - def __init__( - self, - **kwargs - ): - 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. - - :param size_in_gb: Size of the persistent disk in GB. - :type size_in_gb: int - :ivar used_in_gb: Size of the used persistent disk in GB. - :vartype used_in_gb: int - :param mount_path: Mount path of the persistent disk. - :type 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 - ): - 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. - - :param key_type: Required. Type of the test key. Possible values include: "Primary", - "Secondary". - :type key_type: str or ~azure.mgmt.appplatform.v2021_06_01_preview.models.TestKeyType - """ - - _validation = { - 'key_type': {'required': True}, - } - - _attribute_map = { - 'key_type': {'key': 'keyType', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - 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_06_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. - - :param cpu: Required CPU. 1 core can be represented by 1 or 1000m. This should be 500m or 1 for - Basic tier, and {500m, 1, 2, 3, 4} for Standard tier. - :type cpu: str - :param memory: Required memory. 1 GB can be represented by 1Gi or 1024Mi. This should be - {512Mi, 1Gi, 2Gi} for Basic tier, and {512Mi, 1Gi, 2Gi, ..., 8Gi} for Standard tier. - :type memory: str - """ - - _attribute_map = { - 'cpu': {'key': 'cpu', 'type': 'str'}, - 'memory': {'key': 'memory', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - 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. - - :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 - the SKU is available. - :type location_info: - list[~azure.mgmt.appplatform.v2021_06_01_preview.models.ResourceSkuLocationInfo] - :param restrictions: Gets the restrictions because of which SKU cannot be used. This is - empty if there are no restrictions. - :type restrictions: - list[~azure.mgmt.appplatform.v2021_06_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 - ): - 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. - - :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 - """ - - _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'value': {'key': 'value', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - 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. - - :param value: Collection of resource SKU. - :type value: list[~azure.mgmt.appplatform.v2021_06_01_preview.models.ResourceSku] - :param next_link: URL client should use to fetch the next page (per server side paging). - It's null for now, added for future use. - :type next_link: str - """ - - _attribute_map = { - 'value': {'key': 'value', 'type': '[ResourceSku]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(ResourceSkuCollection, self).__init__(**kwargs) - self.value = kwargs.get('value', None) - self.next_link = kwargs.get('next_link', None) - - -class ResourceSkuLocationInfo(msrest.serialization.Model): - """Locations and availability zones where the SKU is available. - - :param location: Gets location of the SKU. - :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.v2021_06_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 - ): - 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. - - :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] - """ - - _attribute_map = { - 'locations': {'key': 'locations', 'type': '[str]'}, - 'zones': {'key': 'zones', 'type': '[str]'}, - } - - def __init__( - self, - **kwargs - ): - 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. - - :param type: Gets the type of restrictions. Possible values include: 'Location', 'Zone'. - Possible values include: "Location", "Zone". - :type type: str or - ~azure.mgmt.appplatform.v2021_06_01_preview.models.ResourceSkuRestrictionsType - :param values: Gets the value of restrictions. If the restriction type is set to - location. This would be different locations where the SKU is restricted. - :type values: list[str] - :param restriction_info: Gets the information about the restriction where the SKU cannot be - used. - :type restriction_info: - ~azure.mgmt.appplatform.v2021_06_01_preview.models.ResourceSkuRestrictionInfo - :param reason_code: Gets the reason for restriction. Possible values include: 'QuotaId', - 'NotAvailableForSubscription'. Possible values include: "QuotaId", - "NotAvailableForSubscription". - :type reason_code: str or - ~azure.mgmt.appplatform.v2021_06_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 - ): - 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. - - :param name: Gets the set of zones that the SKU is available in with the - specified capabilities. - :type name: list[str] - :param capabilities: Gets a list of capabilities that are available for the SKU in the - specified list of zones. - :type capabilities: - list[~azure.mgmt.appplatform.v2021_06_01_preview.models.ResourceSkuCapabilities] - """ - - _attribute_map = { - 'name': {'key': 'name', 'type': '[str]'}, - 'capabilities': {'key': 'capabilities', 'type': '[ResourceSkuCapabilities]'}, - } - - def __init__( - self, - **kwargs - ): - 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. - - :param relative_path: Source relative path. - :type relative_path: str - :param upload_url: Upload URL. - :type upload_url: str - """ - - _attribute_map = { - 'relative_path': {'key': 'relativePath', 'type': 'str'}, - 'upload_url': {'key': 'uploadUrl', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(ResourceUploadDefinition, self).__init__(**kwargs) - self.relative_path = kwargs.get('relative_path', None) - self.upload_url = kwargs.get('upload_url', None) - - -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 - :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] - """ - - _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 - ): - 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 - :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 - """ - - _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 - ): - 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. - - :param value: Collection of Service resources. - :type value: list[~azure.mgmt.appplatform.v2021_06_01_preview.models.ServiceResource] - :param next_link: URL client should use to fetch the next page (per server side paging). - It's null for now, added for future use. - :type next_link: str - """ - - _attribute_map = { - 'value': {'key': 'value', 'type': '[ServiceResource]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(ServiceResourceList, self).__init__(**kwargs) - self.value = kwargs.get('value', None) - self.next_link = kwargs.get('next_link', None) - - -class ServiceSpecification(msrest.serialization.Model): - """Service specification payload. - - :param log_specifications: Specifications of the Log for Azure Monitoring. - :type 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: - list[~azure.mgmt.appplatform.v2021_06_01_preview.models.MetricSpecification] - """ - - _attribute_map = { - 'log_specifications': {'key': 'logSpecifications', 'type': '[LogSpecification]'}, - 'metric_specifications': {'key': 'metricSpecifications', 'type': '[MetricSpecification]'}, - } - - def __init__( - self, - **kwargs - ): - super(ServiceSpecification, self).__init__(**kwargs) - self.log_specifications = kwargs.get('log_specifications', None) - self.metric_specifications = kwargs.get('metric_specifications', None) - - -class Sku(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 - """ - - _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'tier': {'key': 'tier', 'type': 'str'}, - 'capacity': {'key': 'capacity', 'type': 'int'}, - } - - def __init__( - self, - **kwargs - ): - super(Sku, self).__init__(**kwargs) - self.name = kwargs.get('name', "S0") - self.tier = kwargs.get('tier', "Standard") - self.capacity = kwargs.get('capacity', None) - - -class SkuCapacity(msrest.serialization.Model): - """The SKU capacity. - - 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", - "Manual", "Automatic". - :type scale_type: str or ~azure.mgmt.appplatform.v2021_06_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 - ): - 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 SupportedRuntimeVersion(msrest.serialization.Model): - """Supported deployment runtime version descriptor. - - :param value: The raw value which could be passed to deployment CRUD operations. Possible - values include: "Java_8", "Java_11", "NetCore_31". - :type value: str or ~azure.mgmt.appplatform.v2021_06_01_preview.models.SupportedRuntimeValue - :param platform: The platform of this runtime version (possible values: "Java" or ".NET"). - Possible values include: "Java", ".NET Core". - :type 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 - """ - - _attribute_map = { - 'value': {'key': 'value', 'type': 'str'}, - 'platform': {'key': 'platform', 'type': 'str'}, - 'version': {'key': 'version', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(SupportedRuntimeVersion, self).__init__(**kwargs) - self.value = kwargs.get('value', None) - self.platform = kwargs.get('platform', None) - self.version = kwargs.get('version', None) - - -class TemporaryDisk(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 - """ - - _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 - ): - super(TemporaryDisk, self).__init__(**kwargs) - self.size_in_gb = kwargs.get('size_in_gb', None) - self.mount_path = kwargs.get('mount_path', None) - - -class TestKeys(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 - """ - - _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 - ): - 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. - - :param type: Type of the source uploaded. Possible values include: "Jar", "NetCoreZip", - "Source", "Container". - :type type: str or ~azure.mgmt.appplatform.v2021_06_01_preview.models.UserSourceType - :param relative_path: Relative path of the storage which stores the source. - :type relative_path: str - :param version: Version of the source. - :type version: str - :param artifact_selector: Selector for the artifact to be used for the deployment for - multi-module projects. This should be - the relative path to the target module/project. - :type artifact_selector: str - :param custom_container: Custom container payload. - :type custom_container: ~azure.mgmt.appplatform.v2021_06_01_preview.models.CustomContainer - """ - - _attribute_map = { - '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 - ): - 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_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 f2bb0bee5df1..1cd1bb6ef9ec 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 eea853d99338..717d6cd5fa95 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,25 +5,316 @@ # 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 +import functools +from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union 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 - -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]] +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +JSONType = Any +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_get_request( + subscription_id: str, + resource_group_name: str, + service_name: str, + app_name: str, + *, + sync_status: Optional[str] = None, + **kwargs: Any +) -> 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') + 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: str, + resource_group_name: str, + service_name: str, + app_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> 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, + json=json, + content=content, + **kwargs + ) + + +def build_delete_request_initial( + subscription_id: str, + resource_group_name: str, + service_name: str, + app_name: str, + **kwargs: Any +) -> 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: str, + resource_group_name: str, + service_name: str, + app_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> 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, + json=json, + content=content, + **kwargs + ) + + +def build_list_request( + subscription_id: str, + resource_group_name: str, + service_name: str, + **kwargs: Any +) -> 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: str, + resource_group_name: str, + service_name: str, + app_name: str, + **kwargs: Any +) -> 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: str, + resource_group_name: str, + service_name: str, + app_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> 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, + json=json, + content=content, + **kwargs + ) class AppsOperations(object): """AppsOperations operations. @@ -47,15 +338,15 @@ def __init__(self, client, config, serializer, deserializer): 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" + 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 @@ -77,30 +368,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,49 +394,40 @@ 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 - service_name, # type: str - app_name, # type: str - app_resource, # type: "_models.AppResource" - **kwargs # type: Any - ): - # type: (...) -> "_models.AppResource" + resource_group_name: str, + service_name: str, + app_name: str, + app_resource: "_models.AppResource", + **kwargs: Any + ) -> "_models.AppResource": cls = kwargs.pop('cls', None) # type: ClsType["_models.AppResource"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._create_or_update_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - 'appName': self._serialize.url("app_name", app_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + 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 @@ -177,17 +448,19 @@ 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 - service_name, # type: str - app_name, # type: str - app_resource, # type: "_models.AppResource" - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.AppResource"] + resource_group_name: str, + service_name: str, + app_name: str, + app_resource: "_models.AppResource", + **kwargs: Any + ) -> 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 @@ -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,43 +526,33 @@ 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( self, - resource_group_name, # type: str - service_name, # type: str - app_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + resource_group_name: str, + service_name: str, + app_name: str, + **kwargs: Any + ) -> None: cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01-preview" - accept = "application/json" - - # Construct URL - url = self._delete_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - 'appName': self._serialize.url("app_name", app_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = 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,14 +565,15 @@ 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 - service_name, # type: str - app_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> LROPoller[None] + resource_group_name: str, + service_name: str, + app_name: str, + **kwargs: Any + ) -> LROPoller[None]: """Operation to delete an App. :param resource_group_name: The name of the resource group that contains the resource. You can @@ -323,15 +585,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 +610,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,49 +629,39 @@ 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( 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" + resource_group_name: str, + service_name: str, + app_name: str, + app_resource: "_models.AppResource", + **kwargs: Any + ) -> "_models.AppResource": cls = kwargs.pop('cls', None) # type: ClsType["_models.AppResource"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._update_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - 'appName': self._serialize.url("app_name", app_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + 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,17 +679,19 @@ 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 - service_name, # type: str - app_name, # type: str - app_resource, # type: "_models.AppResource" - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.AppResource"] + resource_group_name: str, + service_name: str, + app_name: str, + app_resource: "_models.AppResource", + **kwargs: Any + ) -> 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 @@ -457,15 +705,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 +731,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,15 +757,16 @@ 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 - service_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.AppResourceCollection"] + resource_group_name: str, + service_name: str, + **kwargs: Any + ) -> 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 @@ -528,8 +775,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 +786,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,19 +830,20 @@ 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 - service_name, # type: str - app_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.ResourceUploadDefinition" + 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 @@ -616,28 +863,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,17 +888,19 @@ 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 - service_name, # type: str - app_name, # type: str - validate_payload, # type: "_models.CustomDomainValidatePayload" - **kwargs # type: Any - ): - # type: (...) -> "_models.CustomDomainValidateResult" + 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 @@ -672,7 +911,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 +923,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 +953,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 055f8f16cc17..96e922750768 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,25 +5,239 @@ # 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 +import functools +from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union 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 - -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]] +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +JSONType = Any +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_get_request( + subscription_id: str, + resource_group_name: str, + service_name: str, + app_name: str, + binding_name: str, + **kwargs: Any +) -> 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: str, + resource_group_name: str, + service_name: str, + app_name: str, + binding_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> 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, + json=json, + content=content, + **kwargs + ) + + +def build_delete_request_initial( + subscription_id: str, + resource_group_name: str, + service_name: str, + app_name: str, + binding_name: str, + **kwargs: Any +) -> 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: str, + resource_group_name: str, + service_name: str, + app_name: str, + binding_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> 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, + json=json, + content=content, + **kwargs + ) + + +def build_list_request( + subscription_id: str, + resource_group_name: str, + service_name: str, + app_name: str, + **kwargs: Any +) -> 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 + ) class BindingsOperations(object): """BindingsOperations operations. @@ -47,15 +261,15 @@ def __init__(self, client, config, serializer, deserializer): 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" + 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 @@ -77,29 +291,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,51 +317,42 @@ 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 - service_name, # type: str - app_name, # type: str - binding_name, # type: str - binding_resource, # type: "_models.BindingResource" - **kwargs # type: Any - ): - # type: (...) -> "_models.BindingResource" + resource_group_name: str, + service_name: str, + app_name: str, + binding_name: str, + binding_resource: "_models.BindingResource", + **kwargs: Any + ) -> "_models.BindingResource": cls = kwargs.pop('cls', None) # type: ClsType["_models.BindingResource"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._create_or_update_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - 'appName': self._serialize.url("app_name", app_name, 'str'), - 'bindingName': self._serialize.url("binding_name", binding_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + 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,18 +373,20 @@ 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 - service_name, # type: str - app_name, # type: str - binding_name, # type: str - binding_resource, # type: "_models.BindingResource" - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.BindingResource"] + resource_group_name: str, + service_name: str, + app_name: str, + binding_name: str, + binding_resource: "_models.BindingResource", + **kwargs: Any + ) -> 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 @@ -205,15 +402,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 +429,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,45 +455,35 @@ 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( self, - resource_group_name, # type: str - service_name, # type: str - app_name, # type: str - binding_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + resource_group_name: str, + service_name: str, + app_name: str, + binding_name: str, + **kwargs: Any + ) -> None: cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01-preview" - accept = "application/json" - - # Construct URL - url = self._delete_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - 'appName': self._serialize.url("app_name", app_name, 'str'), - 'bindingName': self._serialize.url("binding_name", binding_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = 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,15 +496,16 @@ 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 - service_name, # type: str - app_name, # type: str - binding_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> LROPoller[None] + resource_group_name: str, + service_name: str, + app_name: str, + binding_name: str, + **kwargs: Any + ) -> LROPoller[None]: """Operation to delete a Binding. :param resource_group_name: The name of the resource group that contains the resource. You can @@ -334,15 +519,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 +545,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,51 +564,41 @@ 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( 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" + resource_group_name: str, + service_name: str, + app_name: str, + binding_name: str, + binding_resource: "_models.BindingResource", + **kwargs: Any + ) -> "_models.BindingResource": cls = kwargs.pop('cls', None) # type: ClsType["_models.BindingResource"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._update_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - 'appName': self._serialize.url("app_name", app_name, 'str'), - 'bindingName': self._serialize.url("binding_name", binding_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + 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,18 +616,20 @@ 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 - service_name, # type: str - app_name, # type: str - binding_name, # type: str - binding_resource, # type: "_models.BindingResource" - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.BindingResource"] + resource_group_name: str, + service_name: str, + app_name: str, + binding_name: str, + binding_resource: "_models.BindingResource", + **kwargs: Any + ) -> 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 @@ -475,15 +645,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 +672,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,16 +698,17 @@ 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 - service_name, # type: str - app_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.BindingResourceCollection"] + resource_group_name: str, + service_name: str, + app_name: str, + **kwargs: Any + ) -> 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 @@ -551,8 +719,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 +730,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 +776,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 51ba407eef86..42ff74e57626 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,25 +5,183 @@ # 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 +import functools +from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union 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 - -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]] +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +JSONType = Any +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_get_request( + subscription_id: str, + resource_group_name: str, + service_name: str, + certificate_name: str, + **kwargs: Any +) -> 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: str, + resource_group_name: str, + service_name: str, + certificate_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> 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, + json=json, + content=content, + **kwargs + ) + + +def build_delete_request_initial( + subscription_id: str, + resource_group_name: str, + service_name: str, + certificate_name: str, + **kwargs: Any +) -> 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: str, + resource_group_name: str, + service_name: str, + **kwargs: Any +) -> 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 + ) class CertificatesOperations(object): """CertificatesOperations operations. @@ -47,14 +205,14 @@ def __init__(self, client, config, serializer, deserializer): 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" + 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 @@ -74,28 +232,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,49 +257,40 @@ 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 - service_name, # type: str - certificate_name, # type: str - certificate_resource, # type: "_models.CertificateResource" - **kwargs # type: Any - ): - # type: (...) -> "_models.CertificateResource" + resource_group_name: str, + service_name: str, + certificate_name: str, + certificate_resource: "_models.CertificateResource", + **kwargs: Any + ) -> "_models.CertificateResource": cls = kwargs.pop('cls', None) # type: ClsType["_models.CertificateResource"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._create_or_update_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - 'certificateName': self._serialize.url("certificate_name", certificate_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + 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,17 +311,19 @@ 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 - service_name, # type: str - certificate_name, # type: str - certificate_resource, # type: "_models.CertificateResource" - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.CertificateResource"] + resource_group_name: str, + service_name: str, + certificate_name: str, + certificate_resource: "_models.CertificateResource", + **kwargs: Any + ) -> LROPoller["_models.CertificateResource"]: """Create or update certificate resource. :param resource_group_name: The name of the resource group that contains the resource. You can @@ -193,18 +334,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 +364,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,43 +390,33 @@ 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( self, - resource_group_name, # type: str - service_name, # type: str - certificate_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + resource_group_name: str, + service_name: str, + certificate_name: str, + **kwargs: Any + ) -> None: cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01-preview" - accept = "application/json" - - # Construct URL - url = self._delete_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - 'certificateName': self._serialize.url("certificate_name", certificate_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = 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,14 +429,15 @@ 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 - service_name, # type: str - certificate_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> LROPoller[None] + resource_group_name: str, + service_name: str, + certificate_name: str, + **kwargs: Any + ) -> LROPoller[None]: """Delete the certificate resource. :param resource_group_name: The name of the resource group that contains the resource. You can @@ -318,15 +449,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 +474,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,15 +493,16 @@ 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 - service_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.CertificateResourceCollection"] + resource_group_name: str, + service_name: str, + **kwargs: Any + ) -> 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 @@ -385,8 +511,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 +522,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 +566,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 aba3e06c24d4..00d8cdc9d36e 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,24 +5,194 @@ # 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 +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 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 - -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]] +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +JSONType = Any +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_get_request( + subscription_id: str, + resource_group_name: str, + service_name: str, + **kwargs: Any +) -> 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: str, + resource_group_name: str, + service_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> 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, + json=json, + content=content, + **kwargs + ) + + +def build_update_patch_request_initial( + subscription_id: str, + resource_group_name: str, + service_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> 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, + json=json, + content=content, + **kwargs + ) + + +def build_validate_request_initial( + subscription_id: str, + resource_group_name: str, + service_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> 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, + json=json, + content=content, + **kwargs + ) class ConfigServersOperations(object): """ConfigServersOperations operations. @@ -46,13 +216,13 @@ def __init__(self, client, config, serializer, deserializer): 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" + 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 @@ -70,27 +240,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,47 +264,38 @@ 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 - service_name, # type: str - config_server_resource, # type: "_models.ConfigServerResource" - **kwargs # type: Any - ): - # type: (...) -> "_models.ConfigServerResource" + resource_group_name: str, + service_name: str, + config_server_resource: "_models.ConfigServerResource", + **kwargs: Any + ) -> "_models.ConfigServerResource": cls = kwargs.pop('cls', None) # type: ClsType["_models.ConfigServerResource"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._update_put_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + 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,16 +313,18 @@ 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 - service_name, # type: str - config_server_resource, # type: "_models.ConfigServerResource" - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.ConfigServerResource"] + resource_group_name: str, + service_name: str, + config_server_resource: "_models.ConfigServerResource", + **kwargs: Any + ) -> LROPoller["_models.ConfigServerResource"]: """Update the config server. :param resource_group_name: The name of the resource group that contains the resource. You can @@ -180,18 +333,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 +362,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,47 +388,37 @@ 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( self, - resource_group_name, # type: str - service_name, # type: str - config_server_resource, # type: "_models.ConfigServerResource" - **kwargs # type: Any - ): - # type: (...) -> "_models.ConfigServerResource" + resource_group_name: str, + service_name: str, + config_server_resource: "_models.ConfigServerResource", + **kwargs: Any + ) -> "_models.ConfigServerResource": cls = kwargs.pop('cls', None) # type: ClsType["_models.ConfigServerResource"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._update_patch_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + 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_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,16 +436,18 @@ 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 - service_name, # type: str - config_server_resource, # type: "_models.ConfigServerResource" - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.ConfigServerResource"] + resource_group_name: str, + service_name: str, + config_server_resource: "_models.ConfigServerResource", + **kwargs: Any + ) -> LROPoller["_models.ConfigServerResource"]: """Update the config server. :param resource_group_name: The name of the resource group that contains the resource. You can @@ -311,18 +456,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 +485,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,47 +511,37 @@ 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( self, - resource_group_name, # type: str - service_name, # type: str - config_server_settings, # type: "_models.ConfigServerSettings" - **kwargs # type: Any - ): - # type: (...) -> "_models.ConfigServerSettingsValidateResult" + resource_group_name: str, + service_name: str, + config_server_settings: "_models.ConfigServerSettings", + **kwargs: Any + ) -> "_models.ConfigServerSettingsValidateResult": cls = kwargs.pop('cls', None) # type: ClsType["_models.ConfigServerSettingsValidateResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._validate_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + 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,16 +559,18 @@ 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 - service_name, # type: str - config_server_settings, # type: "_models.ConfigServerSettings" - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.ConfigServerSettingsValidateResult"] + resource_group_name: str, + service_name: str, + config_server_settings: "_models.ConfigServerSettings", + **kwargs: Any + ) -> 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 @@ -442,18 +579,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 +608,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 +634,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 e7e4cafb94e0..a727ef0b93e8 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,25 +5,239 @@ # 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 +import functools +from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union 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 - -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]] +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +JSONType = Any +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_get_request( + subscription_id: str, + resource_group_name: str, + service_name: str, + app_name: str, + domain_name: str, + **kwargs: Any +) -> 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: str, + resource_group_name: str, + service_name: str, + app_name: str, + domain_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> 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, + json=json, + content=content, + **kwargs + ) + + +def build_delete_request_initial( + subscription_id: str, + resource_group_name: str, + service_name: str, + app_name: str, + domain_name: str, + **kwargs: Any +) -> 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: str, + resource_group_name: str, + service_name: str, + app_name: str, + domain_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> 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, + json=json, + content=content, + **kwargs + ) + + +def build_list_request( + subscription_id: str, + resource_group_name: str, + service_name: str, + app_name: str, + **kwargs: Any +) -> 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 + ) class CustomDomainsOperations(object): """CustomDomainsOperations operations. @@ -47,15 +261,15 @@ def __init__(self, client, config, serializer, deserializer): 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" + 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 @@ -77,29 +291,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,51 +317,42 @@ 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 - service_name, # type: str - app_name, # type: str - domain_name, # type: str - domain_resource, # type: "_models.CustomDomainResource" - **kwargs # type: Any - ): - # type: (...) -> "_models.CustomDomainResource" + resource_group_name: str, + service_name: str, + app_name: str, + domain_name: str, + domain_resource: "_models.CustomDomainResource", + **kwargs: Any + ) -> "_models.CustomDomainResource": cls = kwargs.pop('cls', None) # type: ClsType["_models.CustomDomainResource"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._create_or_update_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - 'appName': self._serialize.url("app_name", app_name, 'str'), - 'domainName': self._serialize.url("domain_name", domain_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + 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,18 +373,20 @@ 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 - service_name, # type: str - app_name, # type: str - domain_name, # type: str - domain_resource, # type: "_models.CustomDomainResource" - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.CustomDomainResource"] + resource_group_name: str, + service_name: str, + app_name: str, + domain_name: str, + domain_resource: "_models.CustomDomainResource", + **kwargs: Any + ) -> 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 @@ -205,15 +402,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 +429,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,45 +455,35 @@ 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( self, - resource_group_name, # type: str - service_name, # type: str - app_name, # type: str - domain_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + resource_group_name: str, + service_name: str, + app_name: str, + domain_name: str, + **kwargs: Any + ) -> None: cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01-preview" - accept = "application/json" - - # Construct URL - url = self._delete_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - 'appName': self._serialize.url("app_name", app_name, 'str'), - 'domainName': self._serialize.url("domain_name", domain_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = 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,15 +496,16 @@ 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 - service_name, # type: str - app_name, # type: str - domain_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> LROPoller[None] + resource_group_name: str, + service_name: str, + app_name: str, + domain_name: str, + **kwargs: Any + ) -> 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 @@ -334,15 +519,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 +545,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,51 +564,41 @@ 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( 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" + resource_group_name: str, + service_name: str, + app_name: str, + domain_name: str, + domain_resource: "_models.CustomDomainResource", + **kwargs: Any + ) -> "_models.CustomDomainResource": cls = kwargs.pop('cls', None) # type: ClsType["_models.CustomDomainResource"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._update_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - 'appName': self._serialize.url("app_name", app_name, 'str'), - 'domainName': self._serialize.url("domain_name", domain_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + 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,18 +616,20 @@ 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 - service_name, # type: str - app_name, # type: str - domain_name, # type: str - domain_resource, # type: "_models.CustomDomainResource" - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.CustomDomainResource"] + resource_group_name: str, + service_name: str, + app_name: str, + domain_name: str, + domain_resource: "_models.CustomDomainResource", + **kwargs: Any + ) -> 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 @@ -475,15 +645,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 +672,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,16 +698,17 @@ 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 - service_name, # type: str - app_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.CustomDomainResourceCollection"] + resource_group_name: str, + service_name: str, + app_name: str, + **kwargs: Any + ) -> 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 @@ -551,8 +719,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 +730,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 +776,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 0c1fe5d247f0..f8a020e7ff14 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,25 +5,438 @@ # 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 +import functools +from typing import Any, Callable, Dict, Generic, Iterable, List, Optional, TypeVar, Union 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 - -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]] +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +JSONType = Any +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_get_request( + subscription_id: str, + resource_group_name: str, + service_name: str, + app_name: str, + deployment_name: str, + **kwargs: Any +) -> 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: str, + resource_group_name: str, + service_name: str, + app_name: str, + deployment_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> 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, + json=json, + content=content, + **kwargs + ) + + +def build_delete_request_initial( + subscription_id: str, + resource_group_name: str, + service_name: str, + app_name: str, + deployment_name: str, + **kwargs: Any +) -> 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: str, + resource_group_name: str, + service_name: str, + app_name: str, + deployment_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> 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, + json=json, + content=content, + **kwargs + ) + + +def build_list_request( + subscription_id: str, + resource_group_name: str, + service_name: str, + app_name: str, + *, + version: Optional[List[str]] = None, + **kwargs: Any +) -> 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') + 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: str, + resource_group_name: str, + service_name: str, + *, + version: Optional[List[str]] = None, + **kwargs: Any +) -> 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}/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: str, + resource_group_name: str, + service_name: str, + app_name: str, + deployment_name: str, + **kwargs: Any +) -> 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: str, + resource_group_name: str, + service_name: str, + app_name: str, + deployment_name: str, + **kwargs: Any +) -> 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: str, + resource_group_name: str, + service_name: str, + app_name: str, + deployment_name: str, + **kwargs: Any +) -> 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: str, + resource_group_name: str, + service_name: str, + app_name: str, + deployment_name: str, + **kwargs: Any +) -> 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 + ) class DeploymentsOperations(object): """DeploymentsOperations operations. @@ -47,15 +460,15 @@ def __init__(self, client, config, serializer, deserializer): 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" + 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 @@ -77,29 +490,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,51 +516,42 @@ 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 - service_name, # type: str - app_name, # type: str - deployment_name, # type: str - deployment_resource, # type: "_models.DeploymentResource" - **kwargs # type: Any - ): - # type: (...) -> "_models.DeploymentResource" + resource_group_name: str, + service_name: str, + app_name: str, + deployment_name: str, + deployment_resource: "_models.DeploymentResource", + **kwargs: Any + ) -> "_models.DeploymentResource": cls = kwargs.pop('cls', None) # type: ClsType["_models.DeploymentResource"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._create_or_update_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - 'appName': self._serialize.url("app_name", app_name, 'str'), - 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + 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,18 +572,20 @@ 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 - service_name, # type: str - app_name, # type: str - deployment_name, # type: str - deployment_resource, # type: "_models.DeploymentResource" - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.DeploymentResource"] + resource_group_name: str, + service_name: str, + app_name: str, + deployment_name: str, + deployment_resource: "_models.DeploymentResource", + **kwargs: Any + ) -> 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 @@ -202,18 +598,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 +629,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,45 +655,35 @@ 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( self, - resource_group_name, # type: str - service_name, # type: str - app_name, # type: str - deployment_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + resource_group_name: str, + service_name: str, + app_name: str, + deployment_name: str, + **kwargs: Any + ) -> None: cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01-preview" - accept = "application/json" - - # Construct URL - url = self._delete_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - 'appName': self._serialize.url("app_name", app_name, 'str'), - 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = 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,15 +696,16 @@ 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 - service_name, # type: str - app_name, # type: str - deployment_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> LROPoller[None] + resource_group_name: str, + service_name: str, + app_name: str, + deployment_name: str, + **kwargs: Any + ) -> LROPoller[None]: """Operation to delete a Deployment. :param resource_group_name: The name of the resource group that contains the resource. You can @@ -334,15 +719,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 +745,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,51 +764,41 @@ 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( 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" + resource_group_name: str, + service_name: str, + app_name: str, + deployment_name: str, + deployment_resource: "_models.DeploymentResource", + **kwargs: Any + ) -> "_models.DeploymentResource": cls = kwargs.pop('cls', None) # type: ClsType["_models.DeploymentResource"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._update_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - 'appName': self._serialize.url("app_name", app_name, 'str'), - 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(deployment_resource, 'DeploymentResource') - # 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, + 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,18 +816,20 @@ 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 - service_name, # type: str - app_name, # type: str - deployment_name, # type: str - deployment_resource, # type: "_models.DeploymentResource" - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.DeploymentResource"] + resource_group_name: str, + service_name: str, + app_name: str, + deployment_name: str, + deployment_resource: "_models.DeploymentResource", + **kwargs: Any + ) -> 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 @@ -472,18 +842,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 +873,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,17 +899,18 @@ 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 - service_name, # type: str - app_name, # type: str - version=None, # type: Optional[List[str]] - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.DeploymentResourceCollection"] + resource_group_name: str, + service_name: str, + app_name: str, + version: Optional[List[str]] = None, + **kwargs: Any + ) -> 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 @@ -554,8 +923,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 +934,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,19 +982,20 @@ 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 - service_name, # type: str - version=None, # type: Optional[List[str]] - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.DeploymentResourceCollection"] + resource_group_name: str, + service_name: str, + version: Optional[List[str]] = None, + **kwargs: Any + ) -> 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 @@ -636,8 +1006,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 +1017,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 +1063,7 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) @@ -701,41 +1071,30 @@ def get_next(next_link=None): 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 + resource_group_name: str, + service_name: str, + app_name: str, + deployment_name: str, + **kwargs: Any + ) -> None: cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01-preview" - accept = "application/json" - - # Construct URL - url = self._start_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - 'appName': self._serialize.url("app_name", app_name, 'str'), - 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = 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,15 +1107,16 @@ 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 - service_name, # type: str - app_name, # type: str - deployment_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> LROPoller[None] + resource_group_name: str, + service_name: str, + app_name: str, + deployment_name: str, + **kwargs: Any + ) -> LROPoller[None]: """Start the deployment. :param resource_group_name: The name of the resource group that contains the resource. You can @@ -770,15 +1130,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 +1156,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,45 +1175,35 @@ 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( self, - resource_group_name, # type: str - service_name, # type: str - app_name, # type: str - deployment_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + resource_group_name: str, + service_name: str, + app_name: str, + deployment_name: str, + **kwargs: Any + ) -> None: cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01-preview" - accept = "application/json" - - # Construct URL - url = self._stop_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - 'appName': self._serialize.url("app_name", app_name, 'str'), - 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = 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,15 +1216,16 @@ 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 - service_name, # type: str - app_name, # type: str - deployment_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> LROPoller[None] + resource_group_name: str, + service_name: str, + app_name: str, + deployment_name: str, + **kwargs: Any + ) -> LROPoller[None]: """Stop the deployment. :param resource_group_name: The name of the resource group that contains the resource. You can @@ -895,15 +1239,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 +1265,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,45 +1284,35 @@ 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( self, - resource_group_name, # type: str - service_name, # type: str - app_name, # type: str - deployment_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + resource_group_name: str, + service_name: str, + app_name: str, + deployment_name: str, + **kwargs: Any + ) -> None: cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01-preview" - accept = "application/json" - - # Construct URL - url = self._restart_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - 'appName': self._serialize.url("app_name", app_name, 'str'), - 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = 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,15 +1325,16 @@ 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 - service_name, # type: str - app_name, # type: str - deployment_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> LROPoller[None] + resource_group_name: str, + service_name: str, + app_name: str, + deployment_name: str, + **kwargs: Any + ) -> LROPoller[None]: """Restart the deployment. :param resource_group_name: The name of the resource group that contains the resource. You can @@ -1020,15 +1348,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 +1374,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,17 +1393,18 @@ 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 - service_name, # type: str - app_name, # type: str - deployment_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> Optional["_models.LogFileUrlResponse"] + 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 @@ -1104,29 +1426,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 +1454,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 4b278909b72a..9f3b6942f93f 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,24 +5,150 @@ # 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 +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 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 - -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]] +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +JSONType = Any +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_get_request( + subscription_id: str, + resource_group_name: str, + service_name: str, + **kwargs: Any +) -> 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: str, + resource_group_name: str, + service_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> 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, + json=json, + content=content, + **kwargs + ) + + +def build_update_patch_request_initial( + subscription_id: str, + resource_group_name: str, + service_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> 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, + json=json, + content=content, + **kwargs + ) class MonitoringSettingsOperations(object): """MonitoringSettingsOperations operations. @@ -46,13 +172,13 @@ def __init__(self, client, config, serializer, deserializer): 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" + 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 @@ -70,27 +196,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,47 +220,38 @@ 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 - service_name, # type: str - monitoring_setting_resource, # type: "_models.MonitoringSettingResource" - **kwargs # type: Any - ): - # type: (...) -> "_models.MonitoringSettingResource" + resource_group_name: str, + service_name: str, + monitoring_setting_resource: "_models.MonitoringSettingResource", + **kwargs: Any + ) -> "_models.MonitoringSettingResource": cls = kwargs.pop('cls', None) # type: ClsType["_models.MonitoringSettingResource"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._update_put_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(monitoring_setting_resource, 'MonitoringSettingResource') - # 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_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,16 +269,18 @@ 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 - service_name, # type: str - monitoring_setting_resource, # type: "_models.MonitoringSettingResource" - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.MonitoringSettingResource"] + resource_group_name: str, + service_name: str, + monitoring_setting_resource: "_models.MonitoringSettingResource", + **kwargs: Any + ) -> LROPoller["_models.MonitoringSettingResource"]: """Update the Monitoring Setting. :param resource_group_name: The name of the resource group that contains the resource. You can @@ -180,18 +289,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 +318,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,47 +344,37 @@ 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( self, - resource_group_name, # type: str - service_name, # type: str - monitoring_setting_resource, # type: "_models.MonitoringSettingResource" - **kwargs # type: Any - ): - # type: (...) -> "_models.MonitoringSettingResource" + resource_group_name: str, + service_name: str, + monitoring_setting_resource: "_models.MonitoringSettingResource", + **kwargs: Any + ) -> "_models.MonitoringSettingResource": cls = kwargs.pop('cls', None) # type: ClsType["_models.MonitoringSettingResource"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._update_patch_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + 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,16 +392,18 @@ 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 - service_name, # type: str - monitoring_setting_resource, # type: "_models.MonitoringSettingResource" - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.MonitoringSettingResource"] + resource_group_name: str, + service_name: str, + monitoring_setting_resource: "_models.MonitoringSettingResource", + **kwargs: Any + ) -> LROPoller["_models.MonitoringSettingResource"]: """Update the Monitoring Setting. :param resource_group_name: The name of the resource group that contains the resource. You can @@ -311,18 +412,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 +441,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 +467,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 3a411f52957b..c64cd50fb045 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,23 +5,50 @@ # 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 +import functools +from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar 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 - -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]] +from .._vendor import _convert_request +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_list_request( + **kwargs: Any +) -> 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 + ) class Operations(object): """Operations operations. @@ -45,16 +72,17 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def list( self, - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.AvailableOperations"] + **kwargs: Any + ) -> Iterable["_models.AvailableOperations"]: """Lists all of the available REST API operations of the Microsoft.AppPlatform provider. :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either AvailableOperations or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2021_06_01_preview.models.AvailableOperations] + :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 +90,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 +128,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 26067aebd4fb..902fd59c47b5 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,22 +5,49 @@ # 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 +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 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 - -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]] +from .._vendor import _convert_request +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_list_runtime_versions_request( + **kwargs: Any +) -> 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 + ) class RuntimeVersionsOperations(object): """RuntimeVersionsOperations operations. @@ -44,11 +71,11 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def list_runtime_versions( self, - **kwargs # type: Any - ): - # type: (...) -> "_models.AvailableRuntimeVersions" + **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 @@ -61,21 +88,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') + + 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) - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -89,4 +109,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 ec19c6b6bc10..cd5b0cb1a5dc 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,25 +5,441 @@ # 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 +import functools +from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union 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 - -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]] +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +JSONType = Any +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_get_request( + subscription_id: str, + resource_group_name: str, + service_name: str, + **kwargs: Any +) -> 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: str, + resource_group_name: str, + service_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> 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, + json=json, + content=content, + **kwargs + ) + + +def build_delete_request_initial( + subscription_id: str, + resource_group_name: str, + service_name: str, + **kwargs: Any +) -> 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: str, + resource_group_name: str, + service_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> 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, + json=json, + content=content, + **kwargs + ) + + +def build_list_test_keys_request( + subscription_id: str, + resource_group_name: str, + service_name: str, + **kwargs: Any +) -> 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: str, + resource_group_name: str, + service_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> 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, + json=json, + content=content, + **kwargs + ) + + +def build_disable_test_endpoint_request( + subscription_id: str, + resource_group_name: str, + service_name: str, + **kwargs: Any +) -> 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: str, + resource_group_name: str, + service_name: str, + **kwargs: Any +) -> 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: str, + location: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> 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, + json=json, + content=content, + **kwargs + ) + + +def build_list_by_subscription_request( + subscription_id: str, + **kwargs: Any +) -> 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: str, + resource_group_name: str, + **kwargs: Any +) -> 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 + ) class ServicesOperations(object): """ServicesOperations operations. @@ -47,13 +463,13 @@ def __init__(self, client, config, serializer, deserializer): 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" + 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 @@ -71,27 +487,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,47 +511,38 @@ 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 - service_name, # type: str - resource, # type: "_models.ServiceResource" - **kwargs # type: Any - ): - # type: (...) -> "_models.ServiceResource" + resource_group_name: str, + service_name: str, + resource: "_models.ServiceResource", + **kwargs: Any + ) -> "_models.ServiceResource": cls = kwargs.pop('cls', None) # type: ClsType["_models.ServiceResource"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._create_or_update_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(resource, 'ServiceResource') - # 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, + 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,16 +563,18 @@ 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 - service_name, # type: str - resource, # type: "_models.ServiceResource" - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.ServiceResource"] + resource_group_name: str, + service_name: str, + resource: "_models.ServiceResource", + **kwargs: Any + ) -> 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 @@ -187,15 +586,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 +611,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,41 +637,31 @@ 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( self, - resource_group_name, # type: str - service_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + resource_group_name: str, + service_name: str, + **kwargs: Any + ) -> None: cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01-preview" - accept = "application/json" - - # Construct URL - url = self._delete_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = 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,13 +674,14 @@ 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 - service_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> LROPoller[None] + resource_group_name: str, + service_name: str, + **kwargs: Any + ) -> LROPoller[None]: """Operation to delete a Service. :param resource_group_name: The name of the resource group that contains the resource. You can @@ -302,15 +691,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 +715,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,47 +734,37 @@ 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( self, - resource_group_name, # type: str - service_name, # type: str - resource, # type: "_models.ServiceResource" - **kwargs # type: Any - ): - # type: (...) -> "_models.ServiceResource" + resource_group_name: str, + service_name: str, + resource: "_models.ServiceResource", + **kwargs: Any + ) -> "_models.ServiceResource": cls = kwargs.pop('cls', None) # type: ClsType["_models.ServiceResource"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._update_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + 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,16 +782,18 @@ 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 - service_name, # type: str - resource, # type: "_models.ServiceResource" - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.ServiceResource"] + resource_group_name: str, + service_name: str, + resource: "_models.ServiceResource", + **kwargs: Any + ) -> 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 @@ -429,15 +805,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 +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: @@ -481,15 +856,16 @@ 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 - service_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.TestKeys" + 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 @@ -507,27 +883,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,16 +907,18 @@ 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 - service_name, # type: str - regenerate_test_key_request, # type: "_models.RegenerateTestKeyRequestPayload" - **kwargs # type: Any - ): - # type: (...) -> "_models.TestKeys" + 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 @@ -559,7 +927,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 +939,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,15 +968,17 @@ 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 - service_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + 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 @@ -635,27 +996,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,13 +1019,14 @@ 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 - service_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.TestKeys" + 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 @@ -692,27 +1044,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,21 +1068,24 @@ 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 - availability_parameters, # type: "_models.NameAvailabilityParameters" - **kwargs # type: Any - ): - # type: (...) -> "_models.NameAvailability" + location: str, + availability_parameters: "_models.NameAvailabilityParameters", + **kwargs: Any + ) -> "_models.NameAvailability": """Checks that the resource name is valid and is not already in use. :param location: the region. :type location: str :param availability_parameters: Parameters supplied to the operation. - :type availability_parameters: ~azure.mgmt.appplatform.v2021_06_01_preview.models.NameAvailabilityParameters + :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 +1096,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,18 +1124,21 @@ 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 - ): - # type: (...) -> Iterable["_models.ServiceResourceList"] + **kwargs: Any + ) -> 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_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 +1146,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,17 +1186,18 @@ 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 - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.ServiceResourceList"] + resource_group_name: str, + **kwargs: Any + ) -> 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 @@ -871,7 +1205,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 +1214,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 +1256,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 8ebe41020358..6e579cdda2f2 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,23 +5,56 @@ # 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 +import functools +from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar 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 - -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]] +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_list_request( + subscription_id: str, + **kwargs: Any +) -> 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 + ) class SkusOperations(object): """SkusOperations operations. @@ -45,16 +78,18 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def list( self, - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.ResourceSkuCollection"] + **kwargs: Any + ) -> 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_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 +97,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 +137,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 000000000000..41ec6d71ff7f --- /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 000000000000..35df4c7df535 --- /dev/null +++ b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2021_09_01_preview/_app_platform_management_client.py @@ -0,0 +1,133 @@ +# 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, Optional, TYPE_CHECKING + +from azure.core.rest import HttpRequest, HttpResponse +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 azure.core.credentials import TokenCredential + +class AppPlatformManagementClient: + """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: "TokenCredential", + 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 = 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: Any + ) -> 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 000000000000..d96e9438720c --- /dev/null +++ b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2021_09_01_preview/_configuration.py @@ -0,0 +1,68 @@ +# 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 ARMChallengeAuthenticationPolicy, ARMHttpLoggingPolicy + +from ._version import VERSION + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + 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: "TokenCredential", + 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 # 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 000000000000..ba96457c09dd --- /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 000000000000..74e48ecd07cf --- /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 000000000000..138f663c53a4 --- /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 000000000000..92453d8691d9 --- /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 = "6.1.0" 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 000000000000..44ce4a5043f8 --- /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 000000000000..d4281523a655 --- /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 000000000000..52ce667de37f --- /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 000000000000..74e48ecd07cf --- /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 000000000000..97c71859bbd5 --- /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 000000000000..affae7481c74 --- /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 000000000000..836b9358c87c --- /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 000000000000..09b403694ae1 --- /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 000000000000..73625b4a9904 --- /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 000000000000..82e57a30012c --- /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 000000000000..3c9c8d9741b0 --- /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 000000000000..01ce2c280904 --- /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 000000000000..4e25d107300a --- /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 000000000000..f2d67ee1d73b --- /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 000000000000..06a90d535738 --- /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 000000000000..b9e15478f5c8 --- /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 000000000000..d9fe38357558 --- /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 000000000000..089cf4eb7627 --- /dev/null +++ b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2021_09_01_preview/models/__init__.py @@ -0,0 +1,223 @@ +# 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 ._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 + + +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 000000000000..52c3fc50c69f --- /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_py3.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2021_09_01_preview/models/_models_py3.py new file mode 100644 index 000000000000..bb83a56e1123 --- /dev/null +++ b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2021_09_01_preview/models/_models_py3.py @@ -0,0 +1,4071 @@ +# 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: 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}, + } + + _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: Optional[str] = None, + **kwargs + ): + """ + :keyword content: 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 000000000000..97c71859bbd5 --- /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 000000000000..ba4ee8de3d9f --- /dev/null +++ b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2021_09_01_preview/operations/_apps_operations.py @@ -0,0 +1,958 @@ +# 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, Iterable, Optional, TypeVar, Union +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 +T = TypeVar('T') +JSONType = Any +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_get_request( + subscription_id: str, + resource_group_name: str, + service_name: str, + app_name: str, + *, + sync_status: Optional[str] = None, + **kwargs: Any +) -> 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') + 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: str, + resource_group_name: str, + service_name: str, + app_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> 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, + json=json, + content=content, + **kwargs + ) + + +def build_delete_request_initial( + subscription_id: str, + resource_group_name: str, + service_name: str, + app_name: str, + **kwargs: Any +) -> 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: str, + resource_group_name: str, + service_name: str, + app_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> 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, + json=json, + content=content, + **kwargs + ) + + +def build_list_request( + subscription_id: str, + resource_group_name: str, + service_name: str, + **kwargs: Any +) -> 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: str, + resource_group_name: str, + service_name: str, + app_name: str, + **kwargs: Any +) -> 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: str, + resource_group_name: str, + service_name: str, + app_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> 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, + json=json, + content=content, + **kwargs + ) + +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: 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 = 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: 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 = 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: str, + service_name: str, + app_name: str, + app_resource: "_models.AppResource", + **kwargs: Any + ) -> 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: 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 = 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: str, + service_name: str, + app_name: str, + **kwargs: Any + ) -> 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: 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 = 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: str, + service_name: str, + app_name: str, + app_resource: "_models.AppResource", + **kwargs: Any + ) -> 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: str, + service_name: str, + **kwargs: Any + ) -> 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: 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 = 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: 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 = 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 000000000000..686a90a8498c --- /dev/null +++ b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2021_09_01_preview/operations/_bindings_operations.py @@ -0,0 +1,783 @@ +# 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, Iterable, Optional, TypeVar, Union +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 +T = TypeVar('T') +JSONType = Any +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_get_request( + subscription_id: str, + resource_group_name: str, + service_name: str, + app_name: str, + binding_name: str, + **kwargs: Any +) -> 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: str, + resource_group_name: str, + service_name: str, + app_name: str, + binding_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> 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, + json=json, + content=content, + **kwargs + ) + + +def build_delete_request_initial( + subscription_id: str, + resource_group_name: str, + service_name: str, + app_name: str, + binding_name: str, + **kwargs: Any +) -> 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: str, + resource_group_name: str, + service_name: str, + app_name: str, + binding_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> 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, + json=json, + content=content, + **kwargs + ) + + +def build_list_request( + subscription_id: str, + resource_group_name: str, + service_name: str, + app_name: str, + **kwargs: Any +) -> 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 + ) + +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: 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 = 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: 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 = 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: str, + service_name: str, + app_name: str, + binding_name: str, + binding_resource: "_models.BindingResource", + **kwargs: Any + ) -> 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: 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 = 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: str, + service_name: str, + app_name: str, + binding_name: str, + **kwargs: Any + ) -> 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: 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 = 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: str, + service_name: str, + app_name: str, + binding_name: str, + binding_resource: "_models.BindingResource", + **kwargs: Any + ) -> 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: str, + service_name: str, + app_name: str, + **kwargs: Any + ) -> 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 000000000000..b13c78297223 --- /dev/null +++ b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2021_09_01_preview/operations/_certificates_operations.py @@ -0,0 +1,573 @@ +# 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, Iterable, Optional, TypeVar, Union +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 +T = TypeVar('T') +JSONType = Any +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_get_request( + subscription_id: str, + resource_group_name: str, + service_name: str, + certificate_name: str, + **kwargs: Any +) -> 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: str, + resource_group_name: str, + service_name: str, + certificate_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> 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, + json=json, + content=content, + **kwargs + ) + + +def build_delete_request_initial( + subscription_id: str, + resource_group_name: str, + service_name: str, + certificate_name: str, + **kwargs: Any +) -> 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: str, + resource_group_name: str, + service_name: str, + **kwargs: Any +) -> 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 + ) + +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: 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 = 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: 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 = 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: str, + service_name: str, + certificate_name: str, + certificate_resource: "_models.CertificateResource", + **kwargs: Any + ) -> 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: 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 = 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: str, + service_name: str, + certificate_name: str, + **kwargs: Any + ) -> 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: str, + service_name: str, + **kwargs: Any + ) -> 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 000000000000..23903a961767 --- /dev/null +++ b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2021_09_01_preview/operations/_config_servers_operations.py @@ -0,0 +1,638 @@ +# 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 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 +T = TypeVar('T') +JSONType = Any +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_get_request( + subscription_id: str, + resource_group_name: str, + service_name: str, + **kwargs: Any +) -> 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: str, + resource_group_name: str, + service_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> 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, + json=json, + content=content, + **kwargs + ) + + +def build_update_patch_request_initial( + subscription_id: str, + resource_group_name: str, + service_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> 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, + json=json, + content=content, + **kwargs + ) + + +def build_validate_request_initial( + subscription_id: str, + resource_group_name: str, + service_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> 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, + json=json, + content=content, + **kwargs + ) + +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: 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 = 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: 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 = 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: str, + service_name: str, + config_server_resource: "_models.ConfigServerResource", + **kwargs: Any + ) -> 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: 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 = 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: str, + service_name: str, + config_server_resource: "_models.ConfigServerResource", + **kwargs: Any + ) -> 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: 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 = 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: str, + service_name: str, + config_server_settings: "_models.ConfigServerSettings", + **kwargs: Any + ) -> 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 000000000000..be265f366f1d --- /dev/null +++ b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2021_09_01_preview/operations/_custom_domains_operations.py @@ -0,0 +1,783 @@ +# 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, Iterable, Optional, TypeVar, Union +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 +T = TypeVar('T') +JSONType = Any +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_get_request( + subscription_id: str, + resource_group_name: str, + service_name: str, + app_name: str, + domain_name: str, + **kwargs: Any +) -> 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: str, + resource_group_name: str, + service_name: str, + app_name: str, + domain_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> 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, + json=json, + content=content, + **kwargs + ) + + +def build_delete_request_initial( + subscription_id: str, + resource_group_name: str, + service_name: str, + app_name: str, + domain_name: str, + **kwargs: Any +) -> 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: str, + resource_group_name: str, + service_name: str, + app_name: str, + domain_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> 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, + json=json, + content=content, + **kwargs + ) + + +def build_list_request( + subscription_id: str, + resource_group_name: str, + service_name: str, + app_name: str, + **kwargs: Any +) -> 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 + ) + +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: 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 = 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: 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 = 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: str, + service_name: str, + app_name: str, + domain_name: str, + domain_resource: "_models.CustomDomainResource", + **kwargs: Any + ) -> 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: 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 = 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: str, + service_name: str, + app_name: str, + domain_name: str, + **kwargs: Any + ) -> 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: 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 = 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: str, + service_name: str, + app_name: str, + domain_name: str, + domain_resource: "_models.CustomDomainResource", + **kwargs: Any + ) -> 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: str, + service_name: str, + app_name: str, + **kwargs: Any + ) -> 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 000000000000..ff9be2e03768 --- /dev/null +++ b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2021_09_01_preview/operations/_deployments_operations.py @@ -0,0 +1,1969 @@ +# 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, Iterable, List, Optional, TypeVar, Union +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 +T = TypeVar('T') +JSONType = Any +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_get_request( + subscription_id: str, + resource_group_name: str, + service_name: str, + app_name: str, + deployment_name: str, + **kwargs: Any +) -> 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: str, + resource_group_name: str, + service_name: str, + app_name: str, + deployment_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> 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, + json=json, + content=content, + **kwargs + ) + + +def build_delete_request_initial( + subscription_id: str, + resource_group_name: str, + service_name: str, + app_name: str, + deployment_name: str, + **kwargs: Any +) -> 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: str, + resource_group_name: str, + service_name: str, + app_name: str, + deployment_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> 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, + json=json, + content=content, + **kwargs + ) + + +def build_list_request( + subscription_id: str, + resource_group_name: str, + service_name: str, + app_name: str, + *, + version: Optional[List[str]] = None, + **kwargs: Any +) -> 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') + 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: str, + resource_group_name: str, + service_name: str, + *, + version: Optional[List[str]] = None, + **kwargs: Any +) -> 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}/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: str, + resource_group_name: str, + service_name: str, + app_name: str, + deployment_name: str, + **kwargs: Any +) -> 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: str, + resource_group_name: str, + service_name: str, + app_name: str, + deployment_name: str, + **kwargs: Any +) -> 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: str, + resource_group_name: str, + service_name: str, + app_name: str, + deployment_name: str, + **kwargs: Any +) -> 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: str, + resource_group_name: str, + service_name: str, + app_name: str, + deployment_name: str, + **kwargs: Any +) -> 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: str, + resource_group_name: str, + service_name: str, + app_name: str, + deployment_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> 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, + json=json, + content=content, + **kwargs + ) + + +def build_generate_thread_dump_request_initial( + subscription_id: str, + resource_group_name: str, + service_name: str, + app_name: str, + deployment_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> 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, + json=json, + content=content, + **kwargs + ) + + +def build_start_jfr_request_initial( + subscription_id: str, + resource_group_name: str, + service_name: str, + app_name: str, + deployment_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> 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, + json=json, + content=content, + **kwargs + ) + +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: 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 = 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: 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 = 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: str, + service_name: str, + app_name: str, + deployment_name: str, + deployment_resource: "_models.DeploymentResource", + **kwargs: Any + ) -> 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: 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 = 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: str, + service_name: str, + app_name: str, + deployment_name: str, + **kwargs: Any + ) -> 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: 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 = 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: str, + service_name: str, + app_name: str, + deployment_name: str, + deployment_resource: "_models.DeploymentResource", + **kwargs: Any + ) -> 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: str, + service_name: str, + app_name: str, + version: Optional[List[str]] = None, + **kwargs: Any + ) -> 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: str, + service_name: str, + version: Optional[List[str]] = None, + **kwargs: Any + ) -> 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: 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 = 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: str, + service_name: str, + app_name: str, + deployment_name: str, + **kwargs: Any + ) -> 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: 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 = 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: str, + service_name: str, + app_name: str, + deployment_name: str, + **kwargs: Any + ) -> 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: 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 = 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: str, + service_name: str, + app_name: str, + deployment_name: str, + **kwargs: Any + ) -> 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: 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 = 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: 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 = 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: str, + service_name: str, + app_name: str, + deployment_name: str, + diagnostic_parameters: "_models.DiagnosticParameters", + **kwargs: Any + ) -> 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: 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 = 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: str, + service_name: str, + app_name: str, + deployment_name: str, + diagnostic_parameters: "_models.DiagnosticParameters", + **kwargs: Any + ) -> 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: 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 = 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: str, + service_name: str, + app_name: str, + deployment_name: str, + diagnostic_parameters: "_models.DiagnosticParameters", + **kwargs: Any + ) -> 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 000000000000..22561f75e618 --- /dev/null +++ b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2021_09_01_preview/operations/_monitoring_settings_operations.py @@ -0,0 +1,471 @@ +# 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 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 +T = TypeVar('T') +JSONType = Any +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_get_request( + subscription_id: str, + resource_group_name: str, + service_name: str, + **kwargs: Any +) -> 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: str, + resource_group_name: str, + service_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> 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, + json=json, + content=content, + **kwargs + ) + + +def build_update_patch_request_initial( + subscription_id: str, + resource_group_name: str, + service_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> 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, + json=json, + content=content, + **kwargs + ) + +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: 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 = 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: 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 = 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: str, + service_name: str, + monitoring_setting_resource: "_models.MonitoringSettingResource", + **kwargs: Any + ) -> 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: 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 = 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: str, + service_name: str, + monitoring_setting_resource: "_models.MonitoringSettingResource", + **kwargs: Any + ) -> 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 000000000000..5233c962e2d2 --- /dev/null +++ b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2021_09_01_preview/operations/_operations.py @@ -0,0 +1,135 @@ +# 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, Iterable, Optional, TypeVar +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 +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_list_request( + **kwargs: Any +) -> 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 + ) + +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: Any + ) -> 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 000000000000..094cd725b34a --- /dev/null +++ b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2021_09_01_preview/operations/_runtime_versions_operations.py @@ -0,0 +1,114 @@ +# 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 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 +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_list_runtime_versions_request( + **kwargs: Any +) -> 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 + ) + +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: 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 = 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 000000000000..00fd1539c593 --- /dev/null +++ b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2021_09_01_preview/operations/_services_operations.py @@ -0,0 +1,1527 @@ +# 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, Iterable, Optional, TypeVar, Union +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 +T = TypeVar('T') +JSONType = Any +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_get_request( + subscription_id: str, + resource_group_name: str, + service_name: str, + **kwargs: Any +) -> 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: str, + resource_group_name: str, + service_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> 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, + json=json, + content=content, + **kwargs + ) + + +def build_delete_request_initial( + subscription_id: str, + resource_group_name: str, + service_name: str, + **kwargs: Any +) -> 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: str, + resource_group_name: str, + service_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> 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, + json=json, + content=content, + **kwargs + ) + + +def build_list_test_keys_request( + subscription_id: str, + resource_group_name: str, + service_name: str, + **kwargs: Any +) -> 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: str, + resource_group_name: str, + service_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> 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, + json=json, + content=content, + **kwargs + ) + + +def build_disable_test_endpoint_request( + subscription_id: str, + resource_group_name: str, + service_name: str, + **kwargs: Any +) -> 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: str, + resource_group_name: str, + service_name: str, + **kwargs: Any +) -> 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: str, + resource_group_name: str, + service_name: str, + **kwargs: Any +) -> 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: str, + resource_group_name: str, + service_name: str, + **kwargs: Any +) -> 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: str, + location: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> 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, + json=json, + content=content, + **kwargs + ) + + +def build_list_by_subscription_request( + subscription_id: str, + **kwargs: Any +) -> 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: str, + resource_group_name: str, + **kwargs: Any +) -> 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 + ) + +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: 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 = 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: 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 = 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: str, + service_name: str, + resource: "_models.ServiceResource", + **kwargs: Any + ) -> 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: 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 = 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: str, + service_name: str, + **kwargs: Any + ) -> 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: 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 = 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: str, + service_name: str, + resource: "_models.ServiceResource", + **kwargs: Any + ) -> 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: 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 = 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: 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 = 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: 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 = 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: 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 = 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: 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 = 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: str, + service_name: str, + **kwargs: Any + ) -> 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: 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 = 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: str, + service_name: str, + **kwargs: Any + ) -> 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: 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 = 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 + ) -> 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: str, + **kwargs: Any + ) -> 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 000000000000..0c32e2626355 --- /dev/null +++ b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2021_09_01_preview/operations/_skus_operations.py @@ -0,0 +1,144 @@ +# 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, Iterable, Optional, TypeVar +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 +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_list_request( + subscription_id: str, + **kwargs: Any +) -> 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 + ) + +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: Any + ) -> 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 000000000000..92ed6ae454d2 --- /dev/null +++ b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2021_09_01_preview/operations/_storages_operations.py @@ -0,0 +1,572 @@ +# 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, Iterable, Optional, TypeVar, Union +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 +T = TypeVar('T') +JSONType = Any +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_get_request( + subscription_id: str, + resource_group_name: str, + service_name: str, + storage_name: str, + **kwargs: Any +) -> 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: str, + resource_group_name: str, + service_name: str, + storage_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> 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, + json=json, + content=content, + **kwargs + ) + + +def build_delete_request_initial( + subscription_id: str, + resource_group_name: str, + service_name: str, + storage_name: str, + **kwargs: Any +) -> 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: str, + resource_group_name: str, + service_name: str, + **kwargs: Any +) -> 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 + ) + +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: 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 = 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: 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 = 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: str, + service_name: str, + storage_name: str, + storage_resource: "_models.StorageResource", + **kwargs: Any + ) -> 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: 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 = 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: str, + service_name: str, + storage_name: str, + **kwargs: Any + ) -> 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: str, + service_name: str, + **kwargs: Any + ) -> 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 000000000000..e5aff4f83af8 --- /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 diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_01_01_preview/__init__.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_01_01_preview/__init__.py new file mode 100644 index 000000000000..41ec6d71ff7f --- /dev/null +++ b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_01_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/v2022_01_01_preview/_app_platform_management_client.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_01_01_preview/_app_platform_management_client.py new file mode 100644 index 000000000000..4b65a5d14b31 --- /dev/null +++ b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_01_01_preview/_app_platform_management_client.py @@ -0,0 +1,176 @@ +# 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, Optional, TYPE_CHECKING + +from azure.core.rest import HttpRequest, HttpResponse +from azure.mgmt.core import ARMPipelineClient +from msrest import Deserializer, Serializer + +from . import models +from ._configuration import AppPlatformManagementClientConfiguration +from .operations import ApiPortalCustomDomainsOperations, ApiPortalsOperations, AppsOperations, BindingsOperations, BuildServiceAgentPoolOperations, BuildServiceBuilderOperations, BuildServiceOperations, BuildpackBindingOperations, CertificatesOperations, ConfigServersOperations, ConfigurationServicesOperations, CustomDomainsOperations, DeploymentsOperations, GatewayCustomDomainsOperations, GatewayRouteConfigsOperations, GatewaysOperations, MonitoringSettingsOperations, Operations, RuntimeVersionsOperations, ServiceRegistriesOperations, ServicesOperations, SkusOperations, StoragesOperations + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from azure.core.credentials import TokenCredential + +class AppPlatformManagementClient: + """REST API for Azure Spring Cloud. + + :ivar services: ServicesOperations operations + :vartype services: azure.mgmt.appplatform.v2022_01_01_preview.operations.ServicesOperations + :ivar config_servers: ConfigServersOperations operations + :vartype config_servers: + azure.mgmt.appplatform.v2022_01_01_preview.operations.ConfigServersOperations + :ivar configuration_services: ConfigurationServicesOperations operations + :vartype configuration_services: + azure.mgmt.appplatform.v2022_01_01_preview.operations.ConfigurationServicesOperations + :ivar service_registries: ServiceRegistriesOperations operations + :vartype service_registries: + azure.mgmt.appplatform.v2022_01_01_preview.operations.ServiceRegistriesOperations + :ivar build_service: BuildServiceOperations operations + :vartype build_service: + azure.mgmt.appplatform.v2022_01_01_preview.operations.BuildServiceOperations + :ivar buildpack_binding: BuildpackBindingOperations operations + :vartype buildpack_binding: + azure.mgmt.appplatform.v2022_01_01_preview.operations.BuildpackBindingOperations + :ivar build_service_builder: BuildServiceBuilderOperations operations + :vartype build_service_builder: + azure.mgmt.appplatform.v2022_01_01_preview.operations.BuildServiceBuilderOperations + :ivar build_service_agent_pool: BuildServiceAgentPoolOperations operations + :vartype build_service_agent_pool: + azure.mgmt.appplatform.v2022_01_01_preview.operations.BuildServiceAgentPoolOperations + :ivar monitoring_settings: MonitoringSettingsOperations operations + :vartype monitoring_settings: + azure.mgmt.appplatform.v2022_01_01_preview.operations.MonitoringSettingsOperations + :ivar apps: AppsOperations operations + :vartype apps: azure.mgmt.appplatform.v2022_01_01_preview.operations.AppsOperations + :ivar bindings: BindingsOperations operations + :vartype bindings: azure.mgmt.appplatform.v2022_01_01_preview.operations.BindingsOperations + :ivar storages: StoragesOperations operations + :vartype storages: azure.mgmt.appplatform.v2022_01_01_preview.operations.StoragesOperations + :ivar certificates: CertificatesOperations operations + :vartype certificates: + azure.mgmt.appplatform.v2022_01_01_preview.operations.CertificatesOperations + :ivar custom_domains: CustomDomainsOperations operations + :vartype custom_domains: + azure.mgmt.appplatform.v2022_01_01_preview.operations.CustomDomainsOperations + :ivar deployments: DeploymentsOperations operations + :vartype deployments: + azure.mgmt.appplatform.v2022_01_01_preview.operations.DeploymentsOperations + :ivar operations: Operations operations + :vartype operations: azure.mgmt.appplatform.v2022_01_01_preview.operations.Operations + :ivar runtime_versions: RuntimeVersionsOperations operations + :vartype runtime_versions: + azure.mgmt.appplatform.v2022_01_01_preview.operations.RuntimeVersionsOperations + :ivar skus: SkusOperations operations + :vartype skus: azure.mgmt.appplatform.v2022_01_01_preview.operations.SkusOperations + :ivar gateways: GatewaysOperations operations + :vartype gateways: azure.mgmt.appplatform.v2022_01_01_preview.operations.GatewaysOperations + :ivar gateway_route_configs: GatewayRouteConfigsOperations operations + :vartype gateway_route_configs: + azure.mgmt.appplatform.v2022_01_01_preview.operations.GatewayRouteConfigsOperations + :ivar gateway_custom_domains: GatewayCustomDomainsOperations operations + :vartype gateway_custom_domains: + azure.mgmt.appplatform.v2022_01_01_preview.operations.GatewayCustomDomainsOperations + :ivar api_portals: ApiPortalsOperations operations + :vartype api_portals: + azure.mgmt.appplatform.v2022_01_01_preview.operations.ApiPortalsOperations + :ivar api_portal_custom_domains: ApiPortalCustomDomainsOperations operations + :vartype api_portal_custom_domains: + azure.mgmt.appplatform.v2022_01_01_preview.operations.ApiPortalCustomDomainsOperations + :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: "TokenCredential", + 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 = 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.configuration_services = ConfigurationServicesOperations(self._client, self._config, self._serialize, self._deserialize) + self.service_registries = ServiceRegistriesOperations(self._client, self._config, self._serialize, self._deserialize) + self.build_service = BuildServiceOperations(self._client, self._config, self._serialize, self._deserialize) + self.buildpack_binding = BuildpackBindingOperations(self._client, self._config, self._serialize, self._deserialize) + self.build_service_builder = BuildServiceBuilderOperations(self._client, self._config, self._serialize, self._deserialize) + self.build_service_agent_pool = BuildServiceAgentPoolOperations(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) + self.gateways = GatewaysOperations(self._client, self._config, self._serialize, self._deserialize) + self.gateway_route_configs = GatewayRouteConfigsOperations(self._client, self._config, self._serialize, self._deserialize) + self.gateway_custom_domains = GatewayCustomDomainsOperations(self._client, self._config, self._serialize, self._deserialize) + self.api_portals = ApiPortalsOperations(self._client, self._config, self._serialize, self._deserialize) + self.api_portal_custom_domains = ApiPortalCustomDomainsOperations(self._client, self._config, self._serialize, self._deserialize) + + + def _send_request( + self, + request, # type: HttpRequest + **kwargs: Any + ) -> 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/v2022_01_01_preview/_configuration.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_01_01_preview/_configuration.py new file mode 100644 index 000000000000..233cdb7bc2d0 --- /dev/null +++ b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_01_01_preview/_configuration.py @@ -0,0 +1,68 @@ +# 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 ARMChallengeAuthenticationPolicy, ARMHttpLoggingPolicy + +from ._version import VERSION + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + 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: "TokenCredential", + 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 = "2022-01-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/v2022_01_01_preview/_metadata.json b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_01_01_preview/_metadata.json new file mode 100644 index 000000000000..4688cc13d796 --- /dev/null +++ b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_01_01_preview/_metadata.json @@ -0,0 +1,124 @@ +{ + "chosen_version": "2022-01-01-preview", + "total_api_version_list": ["2022-01-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", + "configuration_services": "ConfigurationServicesOperations", + "service_registries": "ServiceRegistriesOperations", + "build_service": "BuildServiceOperations", + "buildpack_binding": "BuildpackBindingOperations", + "build_service_builder": "BuildServiceBuilderOperations", + "build_service_agent_pool": "BuildServiceAgentPoolOperations", + "monitoring_settings": "MonitoringSettingsOperations", + "apps": "AppsOperations", + "bindings": "BindingsOperations", + "storages": "StoragesOperations", + "certificates": "CertificatesOperations", + "custom_domains": "CustomDomainsOperations", + "deployments": "DeploymentsOperations", + "operations": "Operations", + "runtime_versions": "RuntimeVersionsOperations", + "skus": "SkusOperations", + "gateways": "GatewaysOperations", + "gateway_route_configs": "GatewayRouteConfigsOperations", + "gateway_custom_domains": "GatewayCustomDomainsOperations", + "api_portals": "ApiPortalsOperations", + "api_portal_custom_domains": "ApiPortalCustomDomainsOperations" + } +} \ No newline at end of file diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_01_01_preview/_patch.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_01_01_preview/_patch.py new file mode 100644 index 000000000000..74e48ecd07cf --- /dev/null +++ b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_01_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/v2022_01_01_preview/_vendor.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_01_01_preview/_vendor.py new file mode 100644 index 000000000000..138f663c53a4 --- /dev/null +++ b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_01_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/v2022_01_01_preview/_version.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_01_01_preview/_version.py new file mode 100644 index 000000000000..92453d8691d9 --- /dev/null +++ b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_01_01_preview/_version.py @@ -0,0 +1,9 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +VERSION = "6.1.0" diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_01_01_preview/aio/__init__.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_01_01_preview/aio/__init__.py new file mode 100644 index 000000000000..44ce4a5043f8 --- /dev/null +++ b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_01_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/v2022_01_01_preview/aio/_app_platform_management_client.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_01_01_preview/aio/_app_platform_management_client.py new file mode 100644 index 000000000000..e11d41952bc3 --- /dev/null +++ b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_01_01_preview/aio/_app_platform_management_client.py @@ -0,0 +1,173 @@ +# 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 ApiPortalCustomDomainsOperations, ApiPortalsOperations, AppsOperations, BindingsOperations, BuildServiceAgentPoolOperations, BuildServiceBuilderOperations, BuildServiceOperations, BuildpackBindingOperations, CertificatesOperations, ConfigServersOperations, ConfigurationServicesOperations, CustomDomainsOperations, DeploymentsOperations, GatewayCustomDomainsOperations, GatewayRouteConfigsOperations, GatewaysOperations, MonitoringSettingsOperations, Operations, RuntimeVersionsOperations, ServiceRegistriesOperations, 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.v2022_01_01_preview.aio.operations.ServicesOperations + :ivar config_servers: ConfigServersOperations operations + :vartype config_servers: + azure.mgmt.appplatform.v2022_01_01_preview.aio.operations.ConfigServersOperations + :ivar configuration_services: ConfigurationServicesOperations operations + :vartype configuration_services: + azure.mgmt.appplatform.v2022_01_01_preview.aio.operations.ConfigurationServicesOperations + :ivar service_registries: ServiceRegistriesOperations operations + :vartype service_registries: + azure.mgmt.appplatform.v2022_01_01_preview.aio.operations.ServiceRegistriesOperations + :ivar build_service: BuildServiceOperations operations + :vartype build_service: + azure.mgmt.appplatform.v2022_01_01_preview.aio.operations.BuildServiceOperations + :ivar buildpack_binding: BuildpackBindingOperations operations + :vartype buildpack_binding: + azure.mgmt.appplatform.v2022_01_01_preview.aio.operations.BuildpackBindingOperations + :ivar build_service_builder: BuildServiceBuilderOperations operations + :vartype build_service_builder: + azure.mgmt.appplatform.v2022_01_01_preview.aio.operations.BuildServiceBuilderOperations + :ivar build_service_agent_pool: BuildServiceAgentPoolOperations operations + :vartype build_service_agent_pool: + azure.mgmt.appplatform.v2022_01_01_preview.aio.operations.BuildServiceAgentPoolOperations + :ivar monitoring_settings: MonitoringSettingsOperations operations + :vartype monitoring_settings: + azure.mgmt.appplatform.v2022_01_01_preview.aio.operations.MonitoringSettingsOperations + :ivar apps: AppsOperations operations + :vartype apps: azure.mgmt.appplatform.v2022_01_01_preview.aio.operations.AppsOperations + :ivar bindings: BindingsOperations operations + :vartype bindings: azure.mgmt.appplatform.v2022_01_01_preview.aio.operations.BindingsOperations + :ivar storages: StoragesOperations operations + :vartype storages: azure.mgmt.appplatform.v2022_01_01_preview.aio.operations.StoragesOperations + :ivar certificates: CertificatesOperations operations + :vartype certificates: + azure.mgmt.appplatform.v2022_01_01_preview.aio.operations.CertificatesOperations + :ivar custom_domains: CustomDomainsOperations operations + :vartype custom_domains: + azure.mgmt.appplatform.v2022_01_01_preview.aio.operations.CustomDomainsOperations + :ivar deployments: DeploymentsOperations operations + :vartype deployments: + azure.mgmt.appplatform.v2022_01_01_preview.aio.operations.DeploymentsOperations + :ivar operations: Operations operations + :vartype operations: azure.mgmt.appplatform.v2022_01_01_preview.aio.operations.Operations + :ivar runtime_versions: RuntimeVersionsOperations operations + :vartype runtime_versions: + azure.mgmt.appplatform.v2022_01_01_preview.aio.operations.RuntimeVersionsOperations + :ivar skus: SkusOperations operations + :vartype skus: azure.mgmt.appplatform.v2022_01_01_preview.aio.operations.SkusOperations + :ivar gateways: GatewaysOperations operations + :vartype gateways: azure.mgmt.appplatform.v2022_01_01_preview.aio.operations.GatewaysOperations + :ivar gateway_route_configs: GatewayRouteConfigsOperations operations + :vartype gateway_route_configs: + azure.mgmt.appplatform.v2022_01_01_preview.aio.operations.GatewayRouteConfigsOperations + :ivar gateway_custom_domains: GatewayCustomDomainsOperations operations + :vartype gateway_custom_domains: + azure.mgmt.appplatform.v2022_01_01_preview.aio.operations.GatewayCustomDomainsOperations + :ivar api_portals: ApiPortalsOperations operations + :vartype api_portals: + azure.mgmt.appplatform.v2022_01_01_preview.aio.operations.ApiPortalsOperations + :ivar api_portal_custom_domains: ApiPortalCustomDomainsOperations operations + :vartype api_portal_custom_domains: + azure.mgmt.appplatform.v2022_01_01_preview.aio.operations.ApiPortalCustomDomainsOperations + :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.configuration_services = ConfigurationServicesOperations(self._client, self._config, self._serialize, self._deserialize) + self.service_registries = ServiceRegistriesOperations(self._client, self._config, self._serialize, self._deserialize) + self.build_service = BuildServiceOperations(self._client, self._config, self._serialize, self._deserialize) + self.buildpack_binding = BuildpackBindingOperations(self._client, self._config, self._serialize, self._deserialize) + self.build_service_builder = BuildServiceBuilderOperations(self._client, self._config, self._serialize, self._deserialize) + self.build_service_agent_pool = BuildServiceAgentPoolOperations(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) + self.gateways = GatewaysOperations(self._client, self._config, self._serialize, self._deserialize) + self.gateway_route_configs = GatewayRouteConfigsOperations(self._client, self._config, self._serialize, self._deserialize) + self.gateway_custom_domains = GatewayCustomDomainsOperations(self._client, self._config, self._serialize, self._deserialize) + self.api_portals = ApiPortalsOperations(self._client, self._config, self._serialize, self._deserialize) + self.api_portal_custom_domains = ApiPortalCustomDomainsOperations(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/v2022_01_01_preview/aio/_configuration.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_01_01_preview/aio/_configuration.py new file mode 100644 index 000000000000..606865527339 --- /dev/null +++ b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_01_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 = "2022-01-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/v2022_01_01_preview/aio/_patch.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_01_01_preview/aio/_patch.py new file mode 100644 index 000000000000..74e48ecd07cf --- /dev/null +++ b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_01_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/v2022_01_01_preview/aio/operations/__init__.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_01_01_preview/aio/operations/__init__.py new file mode 100644 index 000000000000..0da100b4246c --- /dev/null +++ b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_01_01_preview/aio/operations/__init__.py @@ -0,0 +1,57 @@ +# 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 ._configuration_services_operations import ConfigurationServicesOperations +from ._service_registries_operations import ServiceRegistriesOperations +from ._build_service_operations import BuildServiceOperations +from ._buildpack_binding_operations import BuildpackBindingOperations +from ._build_service_builder_operations import BuildServiceBuilderOperations +from ._build_service_agent_pool_operations import BuildServiceAgentPoolOperations +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 +from ._gateways_operations import GatewaysOperations +from ._gateway_route_configs_operations import GatewayRouteConfigsOperations +from ._gateway_custom_domains_operations import GatewayCustomDomainsOperations +from ._api_portals_operations import ApiPortalsOperations +from ._api_portal_custom_domains_operations import ApiPortalCustomDomainsOperations + +__all__ = [ + 'ServicesOperations', + 'ConfigServersOperations', + 'ConfigurationServicesOperations', + 'ServiceRegistriesOperations', + 'BuildServiceOperations', + 'BuildpackBindingOperations', + 'BuildServiceBuilderOperations', + 'BuildServiceAgentPoolOperations', + 'MonitoringSettingsOperations', + 'AppsOperations', + 'BindingsOperations', + 'StoragesOperations', + 'CertificatesOperations', + 'CustomDomainsOperations', + 'DeploymentsOperations', + 'Operations', + 'RuntimeVersionsOperations', + 'SkusOperations', + 'GatewaysOperations', + 'GatewayRouteConfigsOperations', + 'GatewayCustomDomainsOperations', + 'ApiPortalsOperations', + 'ApiPortalCustomDomainsOperations', +] diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_01_01_preview/aio/operations/_api_portal_custom_domains_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_01_01_preview/aio/operations/_api_portal_custom_domains_operations.py new file mode 100644 index 000000000000..88f4e4f8db45 --- /dev/null +++ b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_01_01_preview/aio/operations/_api_portal_custom_domains_operations.py @@ -0,0 +1,435 @@ +# 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._api_portal_custom_domains_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 ApiPortalCustomDomainsOperations: + """ApiPortalCustomDomainsOperations 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.v2022_01_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, + api_portal_name: str, + domain_name: str, + **kwargs: Any + ) -> "_models.ApiPortalCustomDomainResource": + """Get the API portal custom domain. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. + :type resource_group_name: str + :param service_name: The name of the Service resource. + :type service_name: str + :param api_portal_name: The name of API portal. + :type api_portal_name: str + :param domain_name: The name of the API portal custom domain. + :type domain_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ApiPortalCustomDomainResource, or the result of cls(response) + :rtype: ~azure.mgmt.appplatform.v2022_01_01_preview.models.ApiPortalCustomDomainResource + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.ApiPortalCustomDomainResource"] + 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, + api_portal_name=api_portal_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('ApiPortalCustomDomainResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apiPortals/{apiPortalName}/domains/{domainName}'} # type: ignore + + + async def _create_or_update_initial( + self, + resource_group_name: str, + service_name: str, + api_portal_name: str, + domain_name: str, + api_portal_custom_domain_resource: "_models.ApiPortalCustomDomainResource", + **kwargs: Any + ) -> "_models.ApiPortalCustomDomainResource": + cls = kwargs.pop('cls', None) # type: ClsType["_models.ApiPortalCustomDomainResource"] + 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(api_portal_custom_domain_resource, 'ApiPortalCustomDomainResource') + + request = build_create_or_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + api_portal_name=api_portal_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]: + 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('ApiPortalCustomDomainResource', pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize('ApiPortalCustomDomainResource', 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}/apiPortals/{apiPortalName}/domains/{domainName}'} # type: ignore + + + @distributed_trace_async + async def begin_create_or_update( + self, + resource_group_name: str, + service_name: str, + api_portal_name: str, + domain_name: str, + api_portal_custom_domain_resource: "_models.ApiPortalCustomDomainResource", + **kwargs: Any + ) -> AsyncLROPoller["_models.ApiPortalCustomDomainResource"]: + """Create or update the API portal custom domain. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. + :type resource_group_name: str + :param service_name: The name of the Service resource. + :type service_name: str + :param api_portal_name: The name of API portal. + :type api_portal_name: str + :param domain_name: The name of the API portal custom domain. + :type domain_name: str + :param api_portal_custom_domain_resource: The API portal custom domain for the create or update + operation. + :type api_portal_custom_domain_resource: + ~azure.mgmt.appplatform.v2022_01_01_preview.models.ApiPortalCustomDomainResource + :keyword callable cls: A custom type or function that will be passed the direct response + :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 ApiPortalCustomDomainResource or the + result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2022_01_01_preview.models.ApiPortalCustomDomainResource] + :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.ApiPortalCustomDomainResource"] + 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, + api_portal_name=api_portal_name, + domain_name=domain_name, + api_portal_custom_domain_resource=api_portal_custom_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('ApiPortalCustomDomainResource', 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}/apiPortals/{apiPortalName}/domains/{domainName}'} # type: ignore + + async def _delete_initial( + self, + resource_group_name: str, + service_name: str, + api_portal_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, + api_portal_name=api_portal_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}/apiPortals/{apiPortalName}/domains/{domainName}'} # type: ignore + + + @distributed_trace_async + async def begin_delete( + self, + resource_group_name: str, + service_name: str, + api_portal_name: str, + domain_name: str, + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Delete the API portal custom domain. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. + :type resource_group_name: str + :param service_name: The name of the Service resource. + :type service_name: str + :param api_portal_name: The name of API portal. + :type api_portal_name: str + :param domain_name: The name of the API portal custom domain. + :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, + api_portal_name=api_portal_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}/apiPortals/{apiPortalName}/domains/{domainName}'} # type: ignore + + @distributed_trace + def list( + self, + resource_group_name: str, + service_name: str, + api_portal_name: str, + **kwargs: Any + ) -> AsyncIterable["_models.ApiPortalCustomDomainResourceCollection"]: + """Handle requests to list all API portal custom domains. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. + :type resource_group_name: str + :param service_name: The name of the Service resource. + :type service_name: str + :param api_portal_name: The name of API portal. + :type api_portal_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either ApiPortalCustomDomainResourceCollection or the + result of cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2022_01_01_preview.models.ApiPortalCustomDomainResourceCollection] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.ApiPortalCustomDomainResourceCollection"] + 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, + api_portal_name=api_portal_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, + api_portal_name=api_portal_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("ApiPortalCustomDomainResourceCollection", 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}/apiPortals/{apiPortalName}/domains'} # type: ignore diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_01_01_preview/aio/operations/_api_portals_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_01_01_preview/aio/operations/_api_portals_operations.py new file mode 100644 index 000000000000..6547113711dc --- /dev/null +++ b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_01_01_preview/aio/operations/_api_portals_operations.py @@ -0,0 +1,477 @@ +# 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._api_portals_operations import build_create_or_update_request_initial, build_delete_request_initial, build_get_request, build_list_request, build_validate_domain_request +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + +class ApiPortalsOperations: + """ApiPortalsOperations 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.v2022_01_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, + api_portal_name: str, + **kwargs: Any + ) -> "_models.ApiPortalResource": + """Get the API portal 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 api_portal_name: The name of API portal. + :type api_portal_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ApiPortalResource, or the result of cls(response) + :rtype: ~azure.mgmt.appplatform.v2022_01_01_preview.models.ApiPortalResource + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.ApiPortalResource"] + 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, + api_portal_name=api_portal_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('ApiPortalResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apiPortals/{apiPortalName}'} # type: ignore + + + async def _create_or_update_initial( + self, + resource_group_name: str, + service_name: str, + api_portal_name: str, + api_portal_resource: "_models.ApiPortalResource", + **kwargs: Any + ) -> "_models.ApiPortalResource": + cls = kwargs.pop('cls', None) # type: ClsType["_models.ApiPortalResource"] + 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(api_portal_resource, 'ApiPortalResource') + + request = build_create_or_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + api_portal_name=api_portal_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]: + 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('ApiPortalResource', pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize('ApiPortalResource', 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}/apiPortals/{apiPortalName}'} # type: ignore + + + @distributed_trace_async + async def begin_create_or_update( + self, + resource_group_name: str, + service_name: str, + api_portal_name: str, + api_portal_resource: "_models.ApiPortalResource", + **kwargs: Any + ) -> AsyncLROPoller["_models.ApiPortalResource"]: + """Create the default API portal or update the existing API portal. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. + :type resource_group_name: str + :param service_name: The name of the Service resource. + :type service_name: str + :param api_portal_name: The name of API portal. + :type api_portal_name: str + :param api_portal_resource: The API portal for the create or update operation. + :type api_portal_resource: ~azure.mgmt.appplatform.v2022_01_01_preview.models.ApiPortalResource + :keyword callable cls: A custom type or function that will be passed the direct response + :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 ApiPortalResource or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2022_01_01_preview.models.ApiPortalResource] + :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.ApiPortalResource"] + 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, + api_portal_name=api_portal_name, + api_portal_resource=api_portal_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('ApiPortalResource', 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}/apiPortals/{apiPortalName}'} # type: ignore + + async def _delete_initial( + self, + resource_group_name: str, + service_name: str, + api_portal_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, + api_portal_name=api_portal_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}/apiPortals/{apiPortalName}'} # type: ignore + + + @distributed_trace_async + async def begin_delete( + self, + resource_group_name: str, + service_name: str, + api_portal_name: str, + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Delete the default API portal. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. + :type resource_group_name: str + :param service_name: The name of the Service resource. + :type service_name: str + :param api_portal_name: The name of API portal. + :type api_portal_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, + api_portal_name=api_portal_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}/apiPortals/{apiPortalName}'} # type: ignore + + @distributed_trace + def list( + self, + resource_group_name: str, + service_name: str, + **kwargs: Any + ) -> AsyncIterable["_models.ApiPortalResourceCollection"]: + """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 ApiPortalResourceCollection or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2022_01_01_preview.models.ApiPortalResourceCollection] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.ApiPortalResourceCollection"] + 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("ApiPortalResourceCollection", 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}/apiPortals'} # type: ignore + + @distributed_trace_async + async def validate_domain( + self, + resource_group_name: str, + service_name: str, + api_portal_name: str, + validate_payload: "_models.CustomDomainValidatePayload", + **kwargs: Any + ) -> "_models.CustomDomainValidateResult": + """Check the domains are 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 api_portal_name: The name of API portal. + :type api_portal_name: str + :param validate_payload: Custom domain payload to be validated. + :type validate_payload: + ~azure.mgmt.appplatform.v2022_01_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.v2022_01_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, + api_portal_name=api_portal_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}/apiPortals/{apiPortalName}/validateDomain'} # type: ignore + diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_01_01_preview/aio/operations/_apps_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_01_01_preview/aio/operations/_apps_operations.py new file mode 100644 index 000000000000..2b5fed9d98f0 --- /dev/null +++ b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_01_01_preview/aio/operations/_apps_operations.py @@ -0,0 +1,797 @@ +# 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_set_active_deployments_request_initial, 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.v2022_01_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.v2022_01_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.v2022_01_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.v2022_01_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.v2022_01_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.v2022_01_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.v2022_01_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.v2022_01_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 + + + async def _set_active_deployments_initial( + self, + resource_group_name: str, + service_name: str, + app_name: str, + active_deployment_collection: "_models.ActiveDeploymentCollection", + **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(active_deployment_collection, 'ActiveDeploymentCollection') + + request = build_set_active_deployments_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._set_active_deployments_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 + + _set_active_deployments_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/setActiveDeployments'} # type: ignore + + + @distributed_trace_async + async def begin_set_active_deployments( + self, + resource_group_name: str, + service_name: str, + app_name: str, + active_deployment_collection: "_models.ActiveDeploymentCollection", + **kwargs: Any + ) -> AsyncLROPoller["_models.AppResource"]: + """Set existing Deployment under the app as active. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource 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 active_deployment_collection: A list of Deployment name to be active. + :type active_deployment_collection: + ~azure.mgmt.appplatform.v2022_01_01_preview.models.ActiveDeploymentCollection + :keyword callable cls: A custom type or function that will be passed the direct response + :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.v2022_01_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._set_active_deployments_initial( + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + active_deployment_collection=active_deployment_collection, + 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_set_active_deployments.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/setActiveDeployments'} # 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.v2022_01_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.v2022_01_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/v2022_01_01_preview/aio/operations/_bindings_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_01_01_preview/aio/operations/_bindings_operations.py new file mode 100644 index 000000000000..65100a629ddc --- /dev/null +++ b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_01_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.v2022_01_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.v2022_01_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.v2022_01_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.v2022_01_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.v2022_01_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.v2022_01_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.v2022_01_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/v2022_01_01_preview/aio/operations/_build_service_agent_pool_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_01_01_preview/aio/operations/_build_service_agent_pool_operations.py new file mode 100644 index 000000000000..a04bc81f0cc4 --- /dev/null +++ b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_01_01_preview/aio/operations/_build_service_agent_pool_operations.py @@ -0,0 +1,325 @@ +# 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._build_service_agent_pool_operations import build_get_request, build_list_request, build_update_put_request_initial +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + +class BuildServiceAgentPoolOperations: + """BuildServiceAgentPoolOperations 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.v2022_01_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, + resource_group_name: str, + service_name: str, + build_service_name: str, + **kwargs: Any + ) -> AsyncIterable["_models.BuildServiceAgentPoolResourceCollection"]: + """List build service agent pool. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. + :type resource_group_name: str + :param service_name: The name of the Service resource. + :type service_name: str + :param build_service_name: The name of the build service resource. + :type build_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 BuildServiceAgentPoolResourceCollection or the + result of cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2022_01_01_preview.models.BuildServiceAgentPoolResourceCollection] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.BuildServiceAgentPoolResourceCollection"] + 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, + build_service_name=build_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, + build_service_name=build_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("BuildServiceAgentPoolResourceCollection", 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}/buildServices/{buildServiceName}/agentPools'} # type: ignore + + @distributed_trace_async + async def get( + self, + resource_group_name: str, + service_name: str, + build_service_name: str, + agent_pool_name: str, + **kwargs: Any + ) -> "_models.BuildServiceAgentPoolResource": + """Get build service agent pool. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. + :type resource_group_name: str + :param service_name: The name of the Service resource. + :type service_name: str + :param build_service_name: The name of the build service resource. + :type build_service_name: str + :param agent_pool_name: The name of the build service agent pool resource. + :type agent_pool_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: BuildServiceAgentPoolResource, or the result of cls(response) + :rtype: ~azure.mgmt.appplatform.v2022_01_01_preview.models.BuildServiceAgentPoolResource + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.BuildServiceAgentPoolResource"] + 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, + build_service_name=build_service_name, + agent_pool_name=agent_pool_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('BuildServiceAgentPoolResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/agentPools/{agentPoolName}'} # type: ignore + + + async def _update_put_initial( + self, + resource_group_name: str, + service_name: str, + build_service_name: str, + agent_pool_name: str, + agent_pool_resource: "_models.BuildServiceAgentPoolResource", + **kwargs: Any + ) -> "_models.BuildServiceAgentPoolResource": + cls = kwargs.pop('cls', None) # type: ClsType["_models.BuildServiceAgentPoolResource"] + 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(agent_pool_resource, 'BuildServiceAgentPoolResource') + + request = build_update_put_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + build_service_name=build_service_name, + agent_pool_name=agent_pool_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, 201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize('BuildServiceAgentPoolResource', pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize('BuildServiceAgentPoolResource', 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}/buildServices/{buildServiceName}/agentPools/{agentPoolName}'} # type: ignore + + + @distributed_trace_async + async def begin_update_put( + self, + resource_group_name: str, + service_name: str, + build_service_name: str, + agent_pool_name: str, + agent_pool_resource: "_models.BuildServiceAgentPoolResource", + **kwargs: Any + ) -> AsyncLROPoller["_models.BuildServiceAgentPoolResource"]: + """Create or update build service agent pool. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. + :type resource_group_name: str + :param service_name: The name of the Service resource. + :type service_name: str + :param build_service_name: The name of the build service resource. + :type build_service_name: str + :param agent_pool_name: The name of the build service agent pool resource. + :type agent_pool_name: str + :param agent_pool_resource: Parameters for the update operation. + :type agent_pool_resource: + ~azure.mgmt.appplatform.v2022_01_01_preview.models.BuildServiceAgentPoolResource + :keyword callable cls: A custom type or function that will be passed the direct response + :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 BuildServiceAgentPoolResource or the + result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2022_01_01_preview.models.BuildServiceAgentPoolResource] + :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.BuildServiceAgentPoolResource"] + 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, + build_service_name=build_service_name, + agent_pool_name=agent_pool_name, + agent_pool_resource=agent_pool_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('BuildServiceAgentPoolResource', 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}/buildServices/{buildServiceName}/agentPools/{agentPoolName}'} # type: ignore diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_01_01_preview/aio/operations/_build_service_builder_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_01_01_preview/aio/operations/_build_service_builder_operations.py new file mode 100644 index 000000000000..1854c7ed87e6 --- /dev/null +++ b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_01_01_preview/aio/operations/_build_service_builder_operations.py @@ -0,0 +1,433 @@ +# 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._build_service_builder_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 BuildServiceBuilderOperations: + """BuildServiceBuilderOperations 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.v2022_01_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, + build_service_name: str, + builder_name: str, + **kwargs: Any + ) -> "_models.BuilderResource": + """Get a KPack builder. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. + :type resource_group_name: str + :param service_name: The name of the Service resource. + :type service_name: str + :param build_service_name: The name of the build service resource. + :type build_service_name: str + :param builder_name: The name of the builder resource. + :type builder_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: BuilderResource, or the result of cls(response) + :rtype: ~azure.mgmt.appplatform.v2022_01_01_preview.models.BuilderResource + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.BuilderResource"] + 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, + build_service_name=build_service_name, + builder_name=builder_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('BuilderResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/builders/{builderName}'} # type: ignore + + + async def _create_or_update_initial( + self, + resource_group_name: str, + service_name: str, + build_service_name: str, + builder_name: str, + builder_resource: "_models.BuilderResource", + **kwargs: Any + ) -> "_models.BuilderResource": + cls = kwargs.pop('cls', None) # type: ClsType["_models.BuilderResource"] + 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(builder_resource, 'BuilderResource') + + request = build_create_or_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + build_service_name=build_service_name, + builder_name=builder_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]: + 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('BuilderResource', pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize('BuilderResource', 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}/buildServices/{buildServiceName}/builders/{builderName}'} # type: ignore + + + @distributed_trace_async + async def begin_create_or_update( + self, + resource_group_name: str, + service_name: str, + build_service_name: str, + builder_name: str, + builder_resource: "_models.BuilderResource", + **kwargs: Any + ) -> AsyncLROPoller["_models.BuilderResource"]: + """Create or update a KPack builder. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. + :type resource_group_name: str + :param service_name: The name of the Service resource. + :type service_name: str + :param build_service_name: The name of the build service resource. + :type build_service_name: str + :param builder_name: The name of the builder resource. + :type builder_name: str + :param builder_resource: The target builder for the create or update operation. + :type builder_resource: ~azure.mgmt.appplatform.v2022_01_01_preview.models.BuilderResource + :keyword callable cls: A custom type or function that will be passed the direct response + :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 BuilderResource or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2022_01_01_preview.models.BuilderResource] + :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.BuilderResource"] + 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, + build_service_name=build_service_name, + builder_name=builder_name, + builder_resource=builder_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('BuilderResource', 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}/buildServices/{buildServiceName}/builders/{builderName}'} # type: ignore + + async def _delete_initial( + self, + resource_group_name: str, + service_name: str, + build_service_name: str, + builder_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, + build_service_name=build_service_name, + builder_name=builder_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}/buildServices/{buildServiceName}/builders/{builderName}'} # type: ignore + + + @distributed_trace_async + async def begin_delete( + self, + resource_group_name: str, + service_name: str, + build_service_name: str, + builder_name: str, + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Delete a KPack builder. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. + :type resource_group_name: str + :param service_name: The name of the Service resource. + :type service_name: str + :param build_service_name: The name of the build service resource. + :type build_service_name: str + :param builder_name: The name of the builder resource. + :type builder_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, + build_service_name=build_service_name, + builder_name=builder_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}/buildServices/{buildServiceName}/builders/{builderName}'} # type: ignore + + @distributed_trace + def list( + self, + resource_group_name: str, + service_name: str, + build_service_name: str, + **kwargs: Any + ) -> AsyncIterable["_models.BuilderResourceCollection"]: + """List KPack builders result. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. + :type resource_group_name: str + :param service_name: The name of the Service resource. + :type service_name: str + :param build_service_name: The name of the build service resource. + :type build_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 BuilderResourceCollection or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2022_01_01_preview.models.BuilderResourceCollection] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.BuilderResourceCollection"] + 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, + build_service_name=build_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, + build_service_name=build_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("BuilderResourceCollection", 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}/buildServices/{buildServiceName}/builders'} # type: ignore diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_01_01_preview/aio/operations/_build_service_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_01_01_preview/aio/operations/_build_service_operations.py new file mode 100644 index 000000000000..353dc21b1c75 --- /dev/null +++ b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_01_01_preview/aio/operations/_build_service_operations.py @@ -0,0 +1,893 @@ +# 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.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._build_service_operations import build_create_or_update_build_request, build_get_build_request, build_get_build_result_log_request, build_get_build_result_request, build_get_build_service_request, build_get_resource_upload_url_request, build_get_supported_buildpack_request, build_get_supported_stack_request, build_list_build_results_request, build_list_build_services_request, build_list_builds_request, build_list_supported_buildpacks_request, build_list_supported_stacks_request +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + +class BuildServiceOperations: + """BuildServiceOperations 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.v2022_01_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_build_services( + self, + resource_group_name: str, + service_name: str, + **kwargs: Any + ) -> AsyncIterable["_models.BuildServiceCollection"]: + """List build services 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 + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either BuildServiceCollection or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2022_01_01_preview.models.BuildServiceCollection] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.BuildServiceCollection"] + 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_build_services_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + template_url=self.list_build_services.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + + request = build_list_build_services_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("BuildServiceCollection", 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_build_services.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices'} # type: ignore + + @distributed_trace_async + async def get_build_service( + self, + resource_group_name: str, + service_name: str, + build_service_name: str, + **kwargs: Any + ) -> "_models.BuildService": + """Get a build service 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 build_service_name: The name of the build service resource. + :type build_service_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: BuildService, or the result of cls(response) + :rtype: ~azure.mgmt.appplatform.v2022_01_01_preview.models.BuildService + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.BuildService"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_get_build_service_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + build_service_name=build_service_name, + template_url=self.get_build_service.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('BuildService', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get_build_service.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}'} # type: ignore + + + @distributed_trace + def list_builds( + self, + resource_group_name: str, + service_name: str, + build_service_name: str, + **kwargs: Any + ) -> AsyncIterable["_models.BuildCollection"]: + """List KPack builds. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. + :type resource_group_name: str + :param service_name: The name of the Service resource. + :type service_name: str + :param build_service_name: The name of the build service resource. + :type build_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 BuildCollection or the result of cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2022_01_01_preview.models.BuildCollection] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.BuildCollection"] + 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_builds_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + build_service_name=build_service_name, + template_url=self.list_builds.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + + request = build_list_builds_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + build_service_name=build_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("BuildCollection", 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_builds.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/builds'} # type: ignore + + @distributed_trace_async + async def get_build( + self, + resource_group_name: str, + service_name: str, + build_service_name: str, + build_name: str, + **kwargs: Any + ) -> "_models.Build": + """Get a KPack build. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. + :type resource_group_name: str + :param service_name: The name of the Service resource. + :type service_name: str + :param build_service_name: The name of the build service resource. + :type build_service_name: str + :param build_name: The name of the build resource. + :type build_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Build, or the result of cls(response) + :rtype: ~azure.mgmt.appplatform.v2022_01_01_preview.models.Build + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.Build"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_get_build_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + build_service_name=build_service_name, + build_name=build_name, + template_url=self.get_build.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('Build', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get_build.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/builds/{buildName}'} # type: ignore + + + @distributed_trace_async + async def create_or_update_build( + self, + resource_group_name: str, + service_name: str, + build_service_name: str, + build_name: str, + build: "_models.Build", + **kwargs: Any + ) -> "_models.Build": + """Create or update a KPack build. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. + :type resource_group_name: str + :param service_name: The name of the Service resource. + :type service_name: str + :param build_service_name: The name of the build service resource. + :type build_service_name: str + :param build_name: The name of the build resource. + :type build_name: str + :param build: Parameters for the create or update operation. + :type build: ~azure.mgmt.appplatform.v2022_01_01_preview.models.Build + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Build, or the result of cls(response) + :rtype: ~azure.mgmt.appplatform.v2022_01_01_preview.models.Build + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.Build"] + 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(build, 'Build') + + request = build_create_or_update_build_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + build_service_name=build_service_name, + build_name=build_name, + content_type=content_type, + json=_json, + template_url=self.create_or_update_build.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]: + 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('Build', pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize('Build', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + create_or_update_build.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/builds/{buildName}'} # type: ignore + + + @distributed_trace + def list_build_results( + self, + resource_group_name: str, + service_name: str, + build_service_name: str, + build_name: str, + **kwargs: Any + ) -> AsyncIterable["_models.BuildResultCollection"]: + """List KPack build results. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. + :type resource_group_name: str + :param service_name: The name of the Service resource. + :type service_name: str + :param build_service_name: The name of the build service resource. + :type build_service_name: str + :param build_name: The name of the build resource. + :type build_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either BuildResultCollection or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2022_01_01_preview.models.BuildResultCollection] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.BuildResultCollection"] + 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_build_results_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + build_service_name=build_service_name, + build_name=build_name, + template_url=self.list_build_results.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + + request = build_list_build_results_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + build_service_name=build_service_name, + build_name=build_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("BuildResultCollection", 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_build_results.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/builds/{buildName}/results'} # type: ignore + + @distributed_trace_async + async def get_build_result( + self, + resource_group_name: str, + service_name: str, + build_service_name: str, + build_name: str, + build_result_name: str, + **kwargs: Any + ) -> "_models.BuildResult": + """Get a KPack build result. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. + :type resource_group_name: str + :param service_name: The name of the Service resource. + :type service_name: str + :param build_service_name: The name of the build service resource. + :type build_service_name: str + :param build_name: The name of the build resource. + :type build_name: str + :param build_result_name: The name of the build result resource. + :type build_result_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: BuildResult, or the result of cls(response) + :rtype: ~azure.mgmt.appplatform.v2022_01_01_preview.models.BuildResult + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.BuildResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_get_build_result_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + build_service_name=build_service_name, + build_name=build_name, + build_result_name=build_result_name, + template_url=self.get_build_result.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('BuildResult', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get_build_result.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/builds/{buildName}/results/{buildResultName}'} # type: ignore + + + @distributed_trace_async + async def get_build_result_log( + self, + resource_group_name: str, + service_name: str, + build_service_name: str, + build_name: str, + build_result_name: str, + **kwargs: Any + ) -> "_models.BuildResultLog": + """Get a KPack build result log download 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 build_service_name: The name of the build service resource. + :type build_service_name: str + :param build_name: The name of the build resource. + :type build_name: str + :param build_result_name: The name of the build result resource. + :type build_result_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: BuildResultLog, or the result of cls(response) + :rtype: ~azure.mgmt.appplatform.v2022_01_01_preview.models.BuildResultLog + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.BuildResultLog"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_get_build_result_log_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + build_service_name=build_service_name, + build_name=build_name, + build_result_name=build_result_name, + template_url=self.get_build_result_log.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('BuildResultLog', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get_build_result_log.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/builds/{buildName}/results/{buildResultName}/getLogFileUrl'} # type: ignore + + + @distributed_trace_async + async def get_resource_upload_url( + self, + resource_group_name: str, + service_name: str, + build_service_name: str, + **kwargs: Any + ) -> "_models.ResourceUploadDefinition": + """Get an resource upload URL for build service, 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 build_service_name: The name of the build service resource. + :type build_service_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.v2022_01_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, + build_service_name=build_service_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}/buildServices/{buildServiceName}/getResourceUploadUrl'} # type: ignore + + + @distributed_trace_async + async def list_supported_buildpacks( + self, + resource_group_name: str, + service_name: str, + build_service_name: str, + **kwargs: Any + ) -> "_models.SupportedBuildpacksCollection": + """Get all supported buildpacks. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. + :type resource_group_name: str + :param service_name: The name of the Service resource. + :type service_name: str + :param build_service_name: The name of the build service resource. + :type build_service_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SupportedBuildpacksCollection, or the result of cls(response) + :rtype: ~azure.mgmt.appplatform.v2022_01_01_preview.models.SupportedBuildpacksCollection + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.SupportedBuildpacksCollection"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_list_supported_buildpacks_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + build_service_name=build_service_name, + template_url=self.list_supported_buildpacks.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('SupportedBuildpacksCollection', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + list_supported_buildpacks.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/supportedBuildpacks'} # type: ignore + + + @distributed_trace_async + async def get_supported_buildpack( + self, + resource_group_name: str, + service_name: str, + build_service_name: str, + buildpack_name: str, + **kwargs: Any + ) -> "_models.SupportedBuildpackResource": + """Get the supported buildpack 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 build_service_name: The name of the build service resource. + :type build_service_name: str + :param buildpack_name: The name of the buildpack resource. + :type buildpack_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SupportedBuildpackResource, or the result of cls(response) + :rtype: ~azure.mgmt.appplatform.v2022_01_01_preview.models.SupportedBuildpackResource + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.SupportedBuildpackResource"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_get_supported_buildpack_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + build_service_name=build_service_name, + buildpack_name=buildpack_name, + template_url=self.get_supported_buildpack.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('SupportedBuildpackResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get_supported_buildpack.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/supportedBuildpacks/{buildpackName}'} # type: ignore + + + @distributed_trace_async + async def list_supported_stacks( + self, + resource_group_name: str, + service_name: str, + build_service_name: str, + **kwargs: Any + ) -> "_models.SupportedStacksCollection": + """Get all supported stacks. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. + :type resource_group_name: str + :param service_name: The name of the Service resource. + :type service_name: str + :param build_service_name: The name of the build service resource. + :type build_service_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SupportedStacksCollection, or the result of cls(response) + :rtype: ~azure.mgmt.appplatform.v2022_01_01_preview.models.SupportedStacksCollection + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.SupportedStacksCollection"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_list_supported_stacks_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + build_service_name=build_service_name, + template_url=self.list_supported_stacks.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('SupportedStacksCollection', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + list_supported_stacks.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/supportedStacks'} # type: ignore + + + @distributed_trace_async + async def get_supported_stack( + self, + resource_group_name: str, + service_name: str, + build_service_name: str, + stack_name: str, + **kwargs: Any + ) -> "_models.SupportedStackResource": + """Get the supported stack 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 build_service_name: The name of the build service resource. + :type build_service_name: str + :param stack_name: The name of the stack resource. + :type stack_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SupportedStackResource, or the result of cls(response) + :rtype: ~azure.mgmt.appplatform.v2022_01_01_preview.models.SupportedStackResource + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.SupportedStackResource"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_get_supported_stack_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + build_service_name=build_service_name, + stack_name=stack_name, + template_url=self.get_supported_stack.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('SupportedStackResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get_supported_stack.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/supportedStacks/{stackName}'} # type: ignore + diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_01_01_preview/aio/operations/_buildpack_binding_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_01_01_preview/aio/operations/_buildpack_binding_operations.py new file mode 100644 index 000000000000..f2e7f71878b2 --- /dev/null +++ b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_01_01_preview/aio/operations/_buildpack_binding_operations.py @@ -0,0 +1,455 @@ +# 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._buildpack_binding_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 BuildpackBindingOperations: + """BuildpackBindingOperations 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.v2022_01_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, + build_service_name: str, + builder_name: str, + buildpack_binding_name: str, + **kwargs: Any + ) -> "_models.BuildpackBindingResource": + """Get a buildpack binding by name. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. + :type resource_group_name: str + :param service_name: The name of the Service resource. + :type service_name: str + :param build_service_name: The name of the build service resource. + :type build_service_name: str + :param builder_name: The name of the builder resource. + :type builder_name: str + :param buildpack_binding_name: The name of the Buildpack Binding Name. + :type buildpack_binding_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: BuildpackBindingResource, or the result of cls(response) + :rtype: ~azure.mgmt.appplatform.v2022_01_01_preview.models.BuildpackBindingResource + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.BuildpackBindingResource"] + 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, + build_service_name=build_service_name, + builder_name=builder_name, + buildpack_binding_name=buildpack_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('BuildpackBindingResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/builders/{builderName}/buildpackBindings/{buildpackBindingName}'} # type: ignore + + + async def _create_or_update_initial( + self, + resource_group_name: str, + service_name: str, + build_service_name: str, + builder_name: str, + buildpack_binding_name: str, + buildpack_binding: "_models.BuildpackBindingResource", + **kwargs: Any + ) -> "_models.BuildpackBindingResource": + cls = kwargs.pop('cls', None) # type: ClsType["_models.BuildpackBindingResource"] + 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(buildpack_binding, 'BuildpackBindingResource') + + request = build_create_or_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + build_service_name=build_service_name, + builder_name=builder_name, + buildpack_binding_name=buildpack_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]: + 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('BuildpackBindingResource', pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize('BuildpackBindingResource', 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}/buildServices/{buildServiceName}/builders/{builderName}/buildpackBindings/{buildpackBindingName}'} # type: ignore + + + @distributed_trace_async + async def begin_create_or_update( + self, + resource_group_name: str, + service_name: str, + build_service_name: str, + builder_name: str, + buildpack_binding_name: str, + buildpack_binding: "_models.BuildpackBindingResource", + **kwargs: Any + ) -> AsyncLROPoller["_models.BuildpackBindingResource"]: + """Create or update a buildpack 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 build_service_name: The name of the build service resource. + :type build_service_name: str + :param builder_name: The name of the builder resource. + :type builder_name: str + :param buildpack_binding_name: The name of the Buildpack Binding Name. + :type buildpack_binding_name: str + :param buildpack_binding: The target buildpack binding for the create or update operation. + :type buildpack_binding: + ~azure.mgmt.appplatform.v2022_01_01_preview.models.BuildpackBindingResource + :keyword callable cls: A custom type or function that will be passed the direct response + :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 BuildpackBindingResource or the + result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2022_01_01_preview.models.BuildpackBindingResource] + :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.BuildpackBindingResource"] + 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, + build_service_name=build_service_name, + builder_name=builder_name, + buildpack_binding_name=buildpack_binding_name, + buildpack_binding=buildpack_binding, + 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('BuildpackBindingResource', 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}/buildServices/{buildServiceName}/builders/{builderName}/buildpackBindings/{buildpackBindingName}'} # type: ignore + + async def _delete_initial( + self, + resource_group_name: str, + service_name: str, + build_service_name: str, + builder_name: str, + buildpack_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, + build_service_name=build_service_name, + builder_name=builder_name, + buildpack_binding_name=buildpack_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}/buildServices/{buildServiceName}/builders/{builderName}/buildpackBindings/{buildpackBindingName}'} # type: ignore + + + @distributed_trace_async + async def begin_delete( + self, + resource_group_name: str, + service_name: str, + build_service_name: str, + builder_name: str, + buildpack_binding_name: str, + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Operation to delete a Buildpack 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 build_service_name: The name of the build service resource. + :type build_service_name: str + :param builder_name: The name of the builder resource. + :type builder_name: str + :param buildpack_binding_name: The name of the Buildpack Binding Name. + :type buildpack_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, + build_service_name=build_service_name, + builder_name=builder_name, + buildpack_binding_name=buildpack_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}/buildServices/{buildServiceName}/builders/{builderName}/buildpackBindings/{buildpackBindingName}'} # type: ignore + + @distributed_trace + def list( + self, + resource_group_name: str, + service_name: str, + build_service_name: str, + builder_name: str, + **kwargs: Any + ) -> AsyncIterable["_models.BuildpackBindingResourceCollection"]: + """Handles requests to list all buildpack bindings in a builder. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. + :type resource_group_name: str + :param service_name: The name of the Service resource. + :type service_name: str + :param build_service_name: The name of the build service resource. + :type build_service_name: str + :param builder_name: The name of the builder resource. + :type builder_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either BuildpackBindingResourceCollection or the result + of cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2022_01_01_preview.models.BuildpackBindingResourceCollection] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.BuildpackBindingResourceCollection"] + 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, + build_service_name=build_service_name, + builder_name=builder_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, + build_service_name=build_service_name, + builder_name=builder_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("BuildpackBindingResourceCollection", 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}/buildServices/{buildServiceName}/builders/{builderName}/buildpackBindings'} # type: ignore diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_01_01_preview/aio/operations/_certificates_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_01_01_preview/aio/operations/_certificates_operations.py new file mode 100644 index 000000000000..698c3687e413 --- /dev/null +++ b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_01_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.v2022_01_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.v2022_01_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.v2022_01_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.v2022_01_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.v2022_01_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/v2022_01_01_preview/aio/operations/_config_servers_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_01_01_preview/aio/operations/_config_servers_operations.py new file mode 100644 index 000000000000..6fafd450c30d --- /dev/null +++ b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_01_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.v2022_01_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.v2022_01_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.v2022_01_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.v2022_01_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.v2022_01_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.v2022_01_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.v2022_01_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.v2022_01_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/v2022_01_01_preview/aio/operations/_configuration_services_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_01_01_preview/aio/operations/_configuration_services_operations.py new file mode 100644 index 000000000000..f956dcd5ffa7 --- /dev/null +++ b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_01_01_preview/aio/operations/_configuration_services_operations.py @@ -0,0 +1,542 @@ +# 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._configuration_services_operations import build_create_or_update_request_initial, build_delete_request_initial, build_get_request, build_list_request, build_validate_request_initial +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + +class ConfigurationServicesOperations: + """ConfigurationServicesOperations 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.v2022_01_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, + configuration_service_name: str, + **kwargs: Any + ) -> "_models.ConfigurationServiceResource": + """Get the Application Configuration 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 + :param configuration_service_name: The name of Application Configuration Service. + :type configuration_service_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ConfigurationServiceResource, or the result of cls(response) + :rtype: ~azure.mgmt.appplatform.v2022_01_01_preview.models.ConfigurationServiceResource + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.ConfigurationServiceResource"] + 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, + configuration_service_name=configuration_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('ConfigurationServiceResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configurationServices/{configurationServiceName}'} # type: ignore + + + async def _create_or_update_initial( + self, + resource_group_name: str, + service_name: str, + configuration_service_name: str, + configuration_service_resource: "_models.ConfigurationServiceResource", + **kwargs: Any + ) -> "_models.ConfigurationServiceResource": + cls = kwargs.pop('cls', None) # type: ClsType["_models.ConfigurationServiceResource"] + 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(configuration_service_resource, 'ConfigurationServiceResource') + + request = build_create_or_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + configuration_service_name=configuration_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]: + 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('ConfigurationServiceResource', pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize('ConfigurationServiceResource', 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}/configurationServices/{configurationServiceName}'} # type: ignore + + + @distributed_trace_async + async def begin_create_or_update( + self, + resource_group_name: str, + service_name: str, + configuration_service_name: str, + configuration_service_resource: "_models.ConfigurationServiceResource", + **kwargs: Any + ) -> AsyncLROPoller["_models.ConfigurationServiceResource"]: + """Create the default Application Configuration Service or update the existing Application + Configuration 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 configuration_service_name: The name of Application Configuration Service. + :type configuration_service_name: str + :param configuration_service_resource: Parameters for the update operation. + :type configuration_service_resource: + ~azure.mgmt.appplatform.v2022_01_01_preview.models.ConfigurationServiceResource + :keyword callable cls: A custom type or function that will be passed the direct response + :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 ConfigurationServiceResource or the + result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2022_01_01_preview.models.ConfigurationServiceResource] + :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.ConfigurationServiceResource"] + 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, + configuration_service_name=configuration_service_name, + configuration_service_resource=configuration_service_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('ConfigurationServiceResource', 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}/configurationServices/{configurationServiceName}'} # type: ignore + + async def _delete_initial( + self, + resource_group_name: str, + service_name: str, + configuration_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, + configuration_service_name=configuration_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 [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}/configurationServices/{configurationServiceName}'} # type: ignore + + + @distributed_trace_async + async def begin_delete( + self, + resource_group_name: str, + service_name: str, + configuration_service_name: str, + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Disable the default Application Configuration 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 configuration_service_name: The name of Application Configuration Service. + :type configuration_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, + configuration_service_name=configuration_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}/configurationServices/{configurationServiceName}'} # type: ignore + + @distributed_trace + def list( + self, + resource_group_name: str, + service_name: str, + **kwargs: Any + ) -> AsyncIterable["_models.ConfigurationServiceResourceCollection"]: + """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 ConfigurationServiceResourceCollection or the + result of cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2022_01_01_preview.models.ConfigurationServiceResourceCollection] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.ConfigurationServiceResourceCollection"] + 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("ConfigurationServiceResourceCollection", 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}/configurationServices'} # type: ignore + + async def _validate_initial( + self, + resource_group_name: str, + service_name: str, + configuration_service_name: str, + settings: "_models.ConfigurationServiceSettings", + **kwargs: Any + ) -> "_models.ConfigurationServiceSettingsValidateResult": + cls = kwargs.pop('cls', None) # type: ClsType["_models.ConfigurationServiceSettingsValidateResult"] + 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(settings, 'ConfigurationServiceSettings') + + request = build_validate_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + configuration_service_name=configuration_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('ConfigurationServiceSettingsValidateResult', pipeline_response) + + if response.status_code == 202: + deserialized = self._deserialize('ConfigurationServiceSettingsValidateResult', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + _validate_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configurationServices/{configurationServiceName}/validate'} # type: ignore + + + @distributed_trace_async + async def begin_validate( + self, + resource_group_name: str, + service_name: str, + configuration_service_name: str, + settings: "_models.ConfigurationServiceSettings", + **kwargs: Any + ) -> AsyncLROPoller["_models.ConfigurationServiceSettingsValidateResult"]: + """Check if the Application Configuration Service 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 configuration_service_name: The name of Application Configuration Service. + :type configuration_service_name: str + :param settings: Application Configuration Service settings to be validated. + :type settings: ~azure.mgmt.appplatform.v2022_01_01_preview.models.ConfigurationServiceSettings + :keyword callable cls: A custom type or function that will be passed the direct response + :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 + ConfigurationServiceSettingsValidateResult or the result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2022_01_01_preview.models.ConfigurationServiceSettingsValidateResult] + :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.ConfigurationServiceSettingsValidateResult"] + 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, + configuration_service_name=configuration_service_name, + settings=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('ConfigurationServiceSettingsValidateResult', 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}/configurationServices/{configurationServiceName}/validate'} # type: ignore diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_01_01_preview/aio/operations/_custom_domains_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_01_01_preview/aio/operations/_custom_domains_operations.py new file mode 100644 index 000000000000..6ad5201bb074 --- /dev/null +++ b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_01_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.v2022_01_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.v2022_01_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.v2022_01_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.v2022_01_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.v2022_01_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.v2022_01_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.v2022_01_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/v2022_01_01_preview/aio/operations/_deployments_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_01_01_preview/aio/operations/_deployments_operations.py new file mode 100644 index 000000000000..2790456fedb2 --- /dev/null +++ b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_01_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.v2022_01_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.v2022_01_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.v2022_01_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.v2022_01_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.v2022_01_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.v2022_01_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.v2022_01_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.v2022_01_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.v2022_01_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.v2022_01_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.v2022_01_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.v2022_01_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/v2022_01_01_preview/aio/operations/_gateway_custom_domains_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_01_01_preview/aio/operations/_gateway_custom_domains_operations.py new file mode 100644 index 000000000000..831414520846 --- /dev/null +++ b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_01_01_preview/aio/operations/_gateway_custom_domains_operations.py @@ -0,0 +1,435 @@ +# 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._gateway_custom_domains_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 GatewayCustomDomainsOperations: + """GatewayCustomDomainsOperations 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.v2022_01_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, + gateway_name: str, + domain_name: str, + **kwargs: Any + ) -> "_models.GatewayCustomDomainResource": + """Get the Spring Cloud Gateway custom domain. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. + :type resource_group_name: str + :param service_name: The name of the Service resource. + :type service_name: str + :param gateway_name: The name of Spring Cloud Gateway. + :type gateway_name: str + :param domain_name: The name of the Spring Cloud Gateway custom domain. + :type domain_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: GatewayCustomDomainResource, or the result of cls(response) + :rtype: ~azure.mgmt.appplatform.v2022_01_01_preview.models.GatewayCustomDomainResource + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.GatewayCustomDomainResource"] + 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, + gateway_name=gateway_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('GatewayCustomDomainResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/gateways/{gatewayName}/domains/{domainName}'} # type: ignore + + + async def _create_or_update_initial( + self, + resource_group_name: str, + service_name: str, + gateway_name: str, + domain_name: str, + gateway_custom_domain_resource: "_models.GatewayCustomDomainResource", + **kwargs: Any + ) -> "_models.GatewayCustomDomainResource": + cls = kwargs.pop('cls', None) # type: ClsType["_models.GatewayCustomDomainResource"] + 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(gateway_custom_domain_resource, 'GatewayCustomDomainResource') + + request = build_create_or_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + gateway_name=gateway_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]: + 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('GatewayCustomDomainResource', pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize('GatewayCustomDomainResource', 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}/gateways/{gatewayName}/domains/{domainName}'} # type: ignore + + + @distributed_trace_async + async def begin_create_or_update( + self, + resource_group_name: str, + service_name: str, + gateway_name: str, + domain_name: str, + gateway_custom_domain_resource: "_models.GatewayCustomDomainResource", + **kwargs: Any + ) -> AsyncLROPoller["_models.GatewayCustomDomainResource"]: + """Create or update the Spring Cloud Gateway custom domain. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. + :type resource_group_name: str + :param service_name: The name of the Service resource. + :type service_name: str + :param gateway_name: The name of Spring Cloud Gateway. + :type gateway_name: str + :param domain_name: The name of the Spring Cloud Gateway custom domain. + :type domain_name: str + :param gateway_custom_domain_resource: The gateway custom domain resource for the create or + update operation. + :type gateway_custom_domain_resource: + ~azure.mgmt.appplatform.v2022_01_01_preview.models.GatewayCustomDomainResource + :keyword callable cls: A custom type or function that will be passed the direct response + :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 GatewayCustomDomainResource or the + result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2022_01_01_preview.models.GatewayCustomDomainResource] + :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.GatewayCustomDomainResource"] + 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, + gateway_name=gateway_name, + domain_name=domain_name, + gateway_custom_domain_resource=gateway_custom_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('GatewayCustomDomainResource', 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}/gateways/{gatewayName}/domains/{domainName}'} # type: ignore + + async def _delete_initial( + self, + resource_group_name: str, + service_name: str, + gateway_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, + gateway_name=gateway_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}/gateways/{gatewayName}/domains/{domainName}'} # type: ignore + + + @distributed_trace_async + async def begin_delete( + self, + resource_group_name: str, + service_name: str, + gateway_name: str, + domain_name: str, + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Delete the Spring Cloud Gateway custom domain. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. + :type resource_group_name: str + :param service_name: The name of the Service resource. + :type service_name: str + :param gateway_name: The name of Spring Cloud Gateway. + :type gateway_name: str + :param domain_name: The name of the Spring Cloud Gateway custom domain. + :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, + gateway_name=gateway_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}/gateways/{gatewayName}/domains/{domainName}'} # type: ignore + + @distributed_trace + def list( + self, + resource_group_name: str, + service_name: str, + gateway_name: str, + **kwargs: Any + ) -> AsyncIterable["_models.GatewayCustomDomainResourceCollection"]: + """Handle requests to list all Spring Cloud Gateway custom domains. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. + :type resource_group_name: str + :param service_name: The name of the Service resource. + :type service_name: str + :param gateway_name: The name of Spring Cloud Gateway. + :type gateway_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either GatewayCustomDomainResourceCollection or the + result of cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2022_01_01_preview.models.GatewayCustomDomainResourceCollection] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.GatewayCustomDomainResourceCollection"] + 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, + gateway_name=gateway_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, + gateway_name=gateway_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("GatewayCustomDomainResourceCollection", 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}/gateways/{gatewayName}/domains'} # type: ignore diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_01_01_preview/aio/operations/_gateway_route_configs_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_01_01_preview/aio/operations/_gateway_route_configs_operations.py new file mode 100644 index 000000000000..bc998f490f55 --- /dev/null +++ b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_01_01_preview/aio/operations/_gateway_route_configs_operations.py @@ -0,0 +1,436 @@ +# 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._gateway_route_configs_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 GatewayRouteConfigsOperations: + """GatewayRouteConfigsOperations 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.v2022_01_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, + gateway_name: str, + route_config_name: str, + **kwargs: Any + ) -> "_models.GatewayRouteConfigResource": + """Get the Spring Cloud Gateway route configs. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. + :type resource_group_name: str + :param service_name: The name of the Service resource. + :type service_name: str + :param gateway_name: The name of Spring Cloud Gateway. + :type gateway_name: str + :param route_config_name: The name of the Spring Cloud Gateway route config. + :type route_config_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: GatewayRouteConfigResource, or the result of cls(response) + :rtype: ~azure.mgmt.appplatform.v2022_01_01_preview.models.GatewayRouteConfigResource + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.GatewayRouteConfigResource"] + 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, + gateway_name=gateway_name, + route_config_name=route_config_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('GatewayRouteConfigResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/gateways/{gatewayName}/routeConfigs/{routeConfigName}'} # type: ignore + + + async def _create_or_update_initial( + self, + resource_group_name: str, + service_name: str, + gateway_name: str, + route_config_name: str, + gateway_route_config_resource: "_models.GatewayRouteConfigResource", + **kwargs: Any + ) -> "_models.GatewayRouteConfigResource": + cls = kwargs.pop('cls', None) # type: ClsType["_models.GatewayRouteConfigResource"] + 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(gateway_route_config_resource, 'GatewayRouteConfigResource') + + request = build_create_or_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + gateway_name=gateway_name, + route_config_name=route_config_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]: + 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('GatewayRouteConfigResource', pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize('GatewayRouteConfigResource', 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}/gateways/{gatewayName}/routeConfigs/{routeConfigName}'} # type: ignore + + + @distributed_trace_async + async def begin_create_or_update( + self, + resource_group_name: str, + service_name: str, + gateway_name: str, + route_config_name: str, + gateway_route_config_resource: "_models.GatewayRouteConfigResource", + **kwargs: Any + ) -> AsyncLROPoller["_models.GatewayRouteConfigResource"]: + """Create the default Spring Cloud Gateway route configs or update the existing Spring Cloud + Gateway route configs. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. + :type resource_group_name: str + :param service_name: The name of the Service resource. + :type service_name: str + :param gateway_name: The name of Spring Cloud Gateway. + :type gateway_name: str + :param route_config_name: The name of the Spring Cloud Gateway route config. + :type route_config_name: str + :param gateway_route_config_resource: The Spring Cloud Gateway route config for the create or + update operation. + :type gateway_route_config_resource: + ~azure.mgmt.appplatform.v2022_01_01_preview.models.GatewayRouteConfigResource + :keyword callable cls: A custom type or function that will be passed the direct response + :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 GatewayRouteConfigResource or the + result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2022_01_01_preview.models.GatewayRouteConfigResource] + :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.GatewayRouteConfigResource"] + 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, + gateway_name=gateway_name, + route_config_name=route_config_name, + gateway_route_config_resource=gateway_route_config_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('GatewayRouteConfigResource', 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}/gateways/{gatewayName}/routeConfigs/{routeConfigName}'} # type: ignore + + async def _delete_initial( + self, + resource_group_name: str, + service_name: str, + gateway_name: str, + route_config_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, + gateway_name=gateway_name, + route_config_name=route_config_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}/gateways/{gatewayName}/routeConfigs/{routeConfigName}'} # type: ignore + + + @distributed_trace_async + async def begin_delete( + self, + resource_group_name: str, + service_name: str, + gateway_name: str, + route_config_name: str, + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Delete the Spring Cloud Gateway route config. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. + :type resource_group_name: str + :param service_name: The name of the Service resource. + :type service_name: str + :param gateway_name: The name of Spring Cloud Gateway. + :type gateway_name: str + :param route_config_name: The name of the Spring Cloud Gateway route config. + :type route_config_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, + gateway_name=gateway_name, + route_config_name=route_config_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}/gateways/{gatewayName}/routeConfigs/{routeConfigName}'} # type: ignore + + @distributed_trace + def list( + self, + resource_group_name: str, + service_name: str, + gateway_name: str, + **kwargs: Any + ) -> AsyncIterable["_models.GatewayRouteConfigResourceCollection"]: + """Handle requests to list all Spring Cloud Gateway route configs. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. + :type resource_group_name: str + :param service_name: The name of the Service resource. + :type service_name: str + :param gateway_name: The name of Spring Cloud Gateway. + :type gateway_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either GatewayRouteConfigResourceCollection or the result + of cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2022_01_01_preview.models.GatewayRouteConfigResourceCollection] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.GatewayRouteConfigResourceCollection"] + 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, + gateway_name=gateway_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, + gateway_name=gateway_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("GatewayRouteConfigResourceCollection", 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}/gateways/{gatewayName}/routeConfigs'} # type: ignore diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_01_01_preview/aio/operations/_gateways_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_01_01_preview/aio/operations/_gateways_operations.py new file mode 100644 index 000000000000..c0a623369222 --- /dev/null +++ b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_01_01_preview/aio/operations/_gateways_operations.py @@ -0,0 +1,477 @@ +# 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._gateways_operations import build_create_or_update_request_initial, build_delete_request_initial, build_get_request, build_list_request, build_validate_domain_request +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + +class GatewaysOperations: + """GatewaysOperations 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.v2022_01_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, + gateway_name: str, + **kwargs: Any + ) -> "_models.GatewayResource": + """Get the Spring Cloud Gateway 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 gateway_name: The name of Spring Cloud Gateway. + :type gateway_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: GatewayResource, or the result of cls(response) + :rtype: ~azure.mgmt.appplatform.v2022_01_01_preview.models.GatewayResource + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.GatewayResource"] + 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, + gateway_name=gateway_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('GatewayResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/gateways/{gatewayName}'} # type: ignore + + + async def _create_or_update_initial( + self, + resource_group_name: str, + service_name: str, + gateway_name: str, + gateway_resource: "_models.GatewayResource", + **kwargs: Any + ) -> "_models.GatewayResource": + cls = kwargs.pop('cls', None) # type: ClsType["_models.GatewayResource"] + 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(gateway_resource, 'GatewayResource') + + request = build_create_or_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + gateway_name=gateway_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]: + 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('GatewayResource', pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize('GatewayResource', 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}/gateways/{gatewayName}'} # type: ignore + + + @distributed_trace_async + async def begin_create_or_update( + self, + resource_group_name: str, + service_name: str, + gateway_name: str, + gateway_resource: "_models.GatewayResource", + **kwargs: Any + ) -> AsyncLROPoller["_models.GatewayResource"]: + """Create the default Spring Cloud Gateway or update the existing Spring Cloud Gateway. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. + :type resource_group_name: str + :param service_name: The name of the Service resource. + :type service_name: str + :param gateway_name: The name of Spring Cloud Gateway. + :type gateway_name: str + :param gateway_resource: The gateway for the create or update operation. + :type gateway_resource: ~azure.mgmt.appplatform.v2022_01_01_preview.models.GatewayResource + :keyword callable cls: A custom type or function that will be passed the direct response + :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 GatewayResource or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2022_01_01_preview.models.GatewayResource] + :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.GatewayResource"] + 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, + gateway_name=gateway_name, + gateway_resource=gateway_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('GatewayResource', 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}/gateways/{gatewayName}'} # type: ignore + + async def _delete_initial( + self, + resource_group_name: str, + service_name: str, + gateway_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, + gateway_name=gateway_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}/gateways/{gatewayName}'} # type: ignore + + + @distributed_trace_async + async def begin_delete( + self, + resource_group_name: str, + service_name: str, + gateway_name: str, + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Disable the default Spring Cloud Gateway. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. + :type resource_group_name: str + :param service_name: The name of the Service resource. + :type service_name: str + :param gateway_name: The name of Spring Cloud Gateway. + :type gateway_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, + gateway_name=gateway_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}/gateways/{gatewayName}'} # type: ignore + + @distributed_trace + def list( + self, + resource_group_name: str, + service_name: str, + **kwargs: Any + ) -> AsyncIterable["_models.GatewayResourceCollection"]: + """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 GatewayResourceCollection or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2022_01_01_preview.models.GatewayResourceCollection] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.GatewayResourceCollection"] + 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("GatewayResourceCollection", 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}/gateways'} # type: ignore + + @distributed_trace_async + async def validate_domain( + self, + resource_group_name: str, + service_name: str, + gateway_name: str, + validate_payload: "_models.CustomDomainValidatePayload", + **kwargs: Any + ) -> "_models.CustomDomainValidateResult": + """Check the domains are 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 gateway_name: The name of Spring Cloud Gateway. + :type gateway_name: str + :param validate_payload: Custom domain payload to be validated. + :type validate_payload: + ~azure.mgmt.appplatform.v2022_01_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.v2022_01_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, + gateway_name=gateway_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}/gateways/{gatewayName}/validateDomain'} # type: ignore + diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_01_01_preview/aio/operations/_monitoring_settings_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_01_01_preview/aio/operations/_monitoring_settings_operations.py new file mode 100644 index 000000000000..3622bbc4f75f --- /dev/null +++ b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_01_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.v2022_01_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.v2022_01_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.v2022_01_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.v2022_01_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.v2022_01_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.v2022_01_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/v2022_01_01_preview/aio/operations/_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_01_01_preview/aio/operations/_operations.py new file mode 100644 index 000000000000..557092a733de --- /dev/null +++ b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_01_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.v2022_01_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.v2022_01_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/v2022_01_01_preview/aio/operations/_runtime_versions_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_01_01_preview/aio/operations/_runtime_versions_operations.py new file mode 100644 index 000000000000..45e7e82f64bc --- /dev/null +++ b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_01_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.v2022_01_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.v2022_01_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/v2022_01_01_preview/aio/operations/_service_registries_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_01_01_preview/aio/operations/_service_registries_operations.py new file mode 100644 index 000000000000..4992c5c52ea9 --- /dev/null +++ b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_01_01_preview/aio/operations/_service_registries_operations.py @@ -0,0 +1,400 @@ +# 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._service_registries_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 ServiceRegistriesOperations: + """ServiceRegistriesOperations 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.v2022_01_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, + service_registry_name: str, + **kwargs: Any + ) -> "_models.ServiceRegistryResource": + """Get the Service Registry 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 service_registry_name: The name of Service Registry. + :type service_registry_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ServiceRegistryResource, or the result of cls(response) + :rtype: ~azure.mgmt.appplatform.v2022_01_01_preview.models.ServiceRegistryResource + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.ServiceRegistryResource"] + 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, + service_registry_name=service_registry_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('ServiceRegistryResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/serviceRegistries/{serviceRegistryName}'} # type: ignore + + + async def _create_or_update_initial( + self, + resource_group_name: str, + service_name: str, + service_registry_name: str, + **kwargs: Any + ) -> "_models.ServiceRegistryResource": + cls = kwargs.pop('cls', None) # type: ClsType["_models.ServiceRegistryResource"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_create_or_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + service_registry_name=service_registry_name, + 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]: + 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('ServiceRegistryResource', pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize('ServiceRegistryResource', 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}/serviceRegistries/{serviceRegistryName}'} # type: ignore + + + @distributed_trace_async + async def begin_create_or_update( + self, + resource_group_name: str, + service_name: str, + service_registry_name: str, + **kwargs: Any + ) -> AsyncLROPoller["_models.ServiceRegistryResource"]: + """Create the default Service Registry or update the existing Service Registry. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. + :type resource_group_name: str + :param service_name: The name of the Service resource. + :type service_name: str + :param service_registry_name: The name of Service Registry. + :type service_registry_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 ServiceRegistryResource or the + result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2022_01_01_preview.models.ServiceRegistryResource] + :raises: ~azure.core.exceptions.HttpResponseError + """ + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.ServiceRegistryResource"] + 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, + service_registry_name=service_registry_name, + 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('ServiceRegistryResource', 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}/serviceRegistries/{serviceRegistryName}'} # type: ignore + + async def _delete_initial( + self, + resource_group_name: str, + service_name: str, + service_registry_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, + service_registry_name=service_registry_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}/serviceRegistries/{serviceRegistryName}'} # type: ignore + + + @distributed_trace_async + async def begin_delete( + self, + resource_group_name: str, + service_name: str, + service_registry_name: str, + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Disable the default Service Registry. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. + :type resource_group_name: str + :param service_name: The name of the Service resource. + :type service_name: str + :param service_registry_name: The name of Service Registry. + :type service_registry_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, + service_registry_name=service_registry_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}/serviceRegistries/{serviceRegistryName}'} # type: ignore + + @distributed_trace + def list( + self, + resource_group_name: str, + service_name: str, + **kwargs: Any + ) -> AsyncIterable["_models.ServiceRegistryResourceCollection"]: + """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 ServiceRegistryResourceCollection or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2022_01_01_preview.models.ServiceRegistryResourceCollection] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.ServiceRegistryResourceCollection"] + 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("ServiceRegistryResourceCollection", 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}/serviceRegistries'} # type: ignore diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_01_01_preview/aio/operations/_services_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_01_01_preview/aio/operations/_services_operations.py new file mode 100644 index 000000000000..9706a43c6f73 --- /dev/null +++ b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_01_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.v2022_01_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.v2022_01_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.v2022_01_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.v2022_01_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 [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}'} # 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.v2022_01_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.v2022_01_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.v2022_01_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.v2022_01_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.v2022_01_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.v2022_01_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.v2022_01_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.v2022_01_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.v2022_01_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.v2022_01_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/v2022_01_01_preview/aio/operations/_skus_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_01_01_preview/aio/operations/_skus_operations.py new file mode 100644 index 000000000000..c2c263df7473 --- /dev/null +++ b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_01_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.v2022_01_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.v2022_01_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/v2022_01_01_preview/aio/operations/_storages_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_01_01_preview/aio/operations/_storages_operations.py new file mode 100644 index 000000000000..6923589720c3 --- /dev/null +++ b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_01_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.v2022_01_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.v2022_01_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.v2022_01_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.v2022_01_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.v2022_01_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/v2022_01_01_preview/models/__init__.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_01_01_preview/models/__init__.py new file mode 100644 index 000000000000..6497912c6a15 --- /dev/null +++ b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_01_01_preview/models/__init__.py @@ -0,0 +1,405 @@ +# 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 ._models_py3 import ActiveDeploymentCollection +from ._models_py3 import ApiPortalCustomDomainProperties +from ._models_py3 import ApiPortalCustomDomainResource +from ._models_py3 import ApiPortalCustomDomainResourceCollection +from ._models_py3 import ApiPortalInstance +from ._models_py3 import ApiPortalProperties +from ._models_py3 import ApiPortalResource +from ._models_py3 import ApiPortalResourceCollection +from ._models_py3 import ApiPortalResourceRequests +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 Build +from ._models_py3 import BuildCollection +from ._models_py3 import BuildProperties +from ._models_py3 import BuildResult +from ._models_py3 import BuildResultCollection +from ._models_py3 import BuildResultLog +from ._models_py3 import BuildResultProperties +from ._models_py3 import BuildResultUserSourceInfo +from ._models_py3 import BuildService +from ._models_py3 import BuildServiceAgentPoolProperties +from ._models_py3 import BuildServiceAgentPoolResource +from ._models_py3 import BuildServiceAgentPoolResourceCollection +from ._models_py3 import BuildServiceAgentPoolSizeProperties +from ._models_py3 import BuildServiceCollection +from ._models_py3 import BuildServiceProperties +from ._models_py3 import BuildServicePropertiesResourceRequests +from ._models_py3 import BuildStageProperties +from ._models_py3 import BuilderProperties +from ._models_py3 import BuilderResource +from ._models_py3 import BuilderResourceCollection +from ._models_py3 import BuildpackBindingLaunchProperties +from ._models_py3 import BuildpackBindingProperties +from ._models_py3 import BuildpackBindingResource +from ._models_py3 import BuildpackBindingResourceCollection +from ._models_py3 import BuildpackProperties +from ._models_py3 import BuildpacksGroupProperties +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 ConfigurationServiceGitProperty +from ._models_py3 import ConfigurationServiceGitPropertyValidateResult +from ._models_py3 import ConfigurationServiceGitRepository +from ._models_py3 import ConfigurationServiceInstance +from ._models_py3 import ConfigurationServiceProperties +from ._models_py3 import ConfigurationServiceResource +from ._models_py3 import ConfigurationServiceResourceCollection +from ._models_py3 import ConfigurationServiceResourceRequests +from ._models_py3 import ConfigurationServiceSettings +from ._models_py3 import ConfigurationServiceSettingsValidateResult +from ._models_py3 import ContainerProbeSettings +from ._models_py3 import ContentCertificateProperties +from ._models_py3 import CustomContainer +from ._models_py3 import CustomContainerUserSourceInfo +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 DiagnosticParameters +from ._models_py3 import Error +from ._models_py3 import GatewayApiMetadataProperties +from ._models_py3 import GatewayApiRoute +from ._models_py3 import GatewayCorsProperties +from ._models_py3 import GatewayCustomDomainProperties +from ._models_py3 import GatewayCustomDomainResource +from ._models_py3 import GatewayCustomDomainResourceCollection +from ._models_py3 import GatewayInstance +from ._models_py3 import GatewayOperatorProperties +from ._models_py3 import GatewayOperatorResourceRequests +from ._models_py3 import GatewayProperties +from ._models_py3 import GatewayResource +from ._models_py3 import GatewayResourceCollection +from ._models_py3 import GatewayResourceRequests +from ._models_py3 import GatewayRouteConfigProperties +from ._models_py3 import GatewayRouteConfigResource +from ._models_py3 import GatewayRouteConfigResourceCollection +from ._models_py3 import GitPatternRepository +from ._models_py3 import ImageRegistryCredential +from ._models_py3 import JarUploadedUserSourceInfo +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 NetCoreZipUploadedUserSourceInfo +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 ServiceRegistryInstance +from ._models_py3 import ServiceRegistryProperties +from ._models_py3 import ServiceRegistryResource +from ._models_py3 import ServiceRegistryResourceCollection +from ._models_py3 import ServiceRegistryResourceRequests +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 SourceUploadedUserSourceInfo +from ._models_py3 import SsoProperties +from ._models_py3 import StackProperties +from ._models_py3 import StorageAccount +from ._models_py3 import StorageProperties +from ._models_py3 import StorageResource +from ._models_py3 import StorageResourceCollection +from ._models_py3 import SupportedBuildpackResource +from ._models_py3 import SupportedBuildpackResourceProperties +from ._models_py3 import SupportedBuildpacksCollection +from ._models_py3 import SupportedRuntimeVersion +from ._models_py3 import SupportedStackResource +from ._models_py3 import SupportedStackResourceProperties +from ._models_py3 import SupportedStacksCollection +from ._models_py3 import SystemData +from ._models_py3 import TemporaryDisk +from ._models_py3 import TestKeys +from ._models_py3 import TrackedResource +from ._models_py3 import TriggeredBuildResult +from ._models_py3 import UploadedUserSourceInfo +from ._models_py3 import UserSourceInfo +from ._models_py3 import ValidationMessages + + +from ._app_platform_management_client_enums import ( + ActionType, + ApiPortalProvisioningState, + AppResourceProvisioningState, + BindingType, + BuildProvisioningState, + BuildResultProvisioningState, + BuildServiceProvisioningState, + BuilderProvisioningState, + BuildpackBindingProvisioningState, + ConfigServerState, + ConfigurationServiceProvisioningState, + CreatedByType, + DeploymentResourceProvisioningState, + DeploymentResourceStatus, + GatewayProvisioningState, + KPackBuildStageProvisioningState, + LastModifiedByType, + ManagedIdentityType, + MonitoringSettingState, + PowerState, + ProvisioningState, + ResourceSkuRestrictionsReasonCode, + ResourceSkuRestrictionsType, + ServiceRegistryProvisioningState, + SkuScaleType, + SupportedRuntimePlatform, + SupportedRuntimeValue, + TestKeyType, + TrafficDirection, +) + +__all__ = [ + 'ActiveDeploymentCollection', + 'ApiPortalCustomDomainProperties', + 'ApiPortalCustomDomainResource', + 'ApiPortalCustomDomainResourceCollection', + 'ApiPortalInstance', + 'ApiPortalProperties', + 'ApiPortalResource', + 'ApiPortalResourceCollection', + 'ApiPortalResourceRequests', + 'AppResource', + 'AppResourceCollection', + 'AppResourceProperties', + 'ApplicationInsightsAgentVersions', + 'AvailableOperations', + 'AvailableRuntimeVersions', + 'AzureFileVolume', + 'BindingResource', + 'BindingResourceCollection', + 'BindingResourceProperties', + 'Build', + 'BuildCollection', + 'BuildProperties', + 'BuildResult', + 'BuildResultCollection', + 'BuildResultLog', + 'BuildResultProperties', + 'BuildResultUserSourceInfo', + 'BuildService', + 'BuildServiceAgentPoolProperties', + 'BuildServiceAgentPoolResource', + 'BuildServiceAgentPoolResourceCollection', + 'BuildServiceAgentPoolSizeProperties', + 'BuildServiceCollection', + 'BuildServiceProperties', + 'BuildServicePropertiesResourceRequests', + 'BuildStageProperties', + 'BuilderProperties', + 'BuilderResource', + 'BuilderResourceCollection', + 'BuildpackBindingLaunchProperties', + 'BuildpackBindingProperties', + 'BuildpackBindingResource', + 'BuildpackBindingResourceCollection', + 'BuildpackProperties', + 'BuildpacksGroupProperties', + 'CertificateProperties', + 'CertificateResource', + 'CertificateResourceCollection', + 'CloudErrorBody', + 'ClusterResourceProperties', + 'ConfigServerGitProperty', + 'ConfigServerProperties', + 'ConfigServerResource', + 'ConfigServerSettings', + 'ConfigServerSettingsErrorRecord', + 'ConfigServerSettingsValidateResult', + 'ConfigurationServiceGitProperty', + 'ConfigurationServiceGitPropertyValidateResult', + 'ConfigurationServiceGitRepository', + 'ConfigurationServiceInstance', + 'ConfigurationServiceProperties', + 'ConfigurationServiceResource', + 'ConfigurationServiceResourceCollection', + 'ConfigurationServiceResourceRequests', + 'ConfigurationServiceSettings', + 'ConfigurationServiceSettingsValidateResult', + 'ContainerProbeSettings', + 'ContentCertificateProperties', + 'CustomContainer', + 'CustomContainerUserSourceInfo', + 'CustomDomainProperties', + 'CustomDomainResource', + 'CustomDomainResourceCollection', + 'CustomDomainValidatePayload', + 'CustomDomainValidateResult', + 'CustomPersistentDiskProperties', + 'CustomPersistentDiskResource', + 'DeploymentInstance', + 'DeploymentResource', + 'DeploymentResourceCollection', + 'DeploymentResourceProperties', + 'DeploymentSettings', + 'DiagnosticParameters', + 'Error', + 'GatewayApiMetadataProperties', + 'GatewayApiRoute', + 'GatewayCorsProperties', + 'GatewayCustomDomainProperties', + 'GatewayCustomDomainResource', + 'GatewayCustomDomainResourceCollection', + 'GatewayInstance', + 'GatewayOperatorProperties', + 'GatewayOperatorResourceRequests', + 'GatewayProperties', + 'GatewayResource', + 'GatewayResourceCollection', + 'GatewayResourceRequests', + 'GatewayRouteConfigProperties', + 'GatewayRouteConfigResource', + 'GatewayRouteConfigResourceCollection', + 'GitPatternRepository', + 'ImageRegistryCredential', + 'JarUploadedUserSourceInfo', + 'KeyVaultCertificateProperties', + 'LoadedCertificate', + 'LogFileUrlResponse', + 'LogSpecification', + 'ManagedIdentityProperties', + 'MetricDimension', + 'MetricSpecification', + 'MonitoringSettingProperties', + 'MonitoringSettingResource', + 'NameAvailability', + 'NameAvailabilityParameters', + 'NetCoreZipUploadedUserSourceInfo', + 'NetworkProfile', + 'NetworkProfileOutboundIPs', + 'OperationDetail', + 'OperationDisplay', + 'OperationProperties', + 'PersistentDisk', + 'ProxyResource', + 'RegenerateTestKeyRequestPayload', + 'RequiredTraffic', + 'Resource', + 'ResourceRequests', + 'ResourceSku', + 'ResourceSkuCapabilities', + 'ResourceSkuCollection', + 'ResourceSkuLocationInfo', + 'ResourceSkuRestrictionInfo', + 'ResourceSkuRestrictions', + 'ResourceSkuZoneDetails', + 'ResourceUploadDefinition', + 'ServiceRegistryInstance', + 'ServiceRegistryProperties', + 'ServiceRegistryResource', + 'ServiceRegistryResourceCollection', + 'ServiceRegistryResourceRequests', + 'ServiceResource', + 'ServiceResourceList', + 'ServiceSpecification', + 'Sku', + 'SkuCapacity', + 'SourceUploadedUserSourceInfo', + 'SsoProperties', + 'StackProperties', + 'StorageAccount', + 'StorageProperties', + 'StorageResource', + 'StorageResourceCollection', + 'SupportedBuildpackResource', + 'SupportedBuildpackResourceProperties', + 'SupportedBuildpacksCollection', + 'SupportedRuntimeVersion', + 'SupportedStackResource', + 'SupportedStackResourceProperties', + 'SupportedStacksCollection', + 'SystemData', + 'TemporaryDisk', + 'TestKeys', + 'TrackedResource', + 'TriggeredBuildResult', + 'UploadedUserSourceInfo', + 'UserSourceInfo', + 'ValidationMessages', + 'ActionType', + 'ApiPortalProvisioningState', + 'AppResourceProvisioningState', + 'BindingType', + 'BuildProvisioningState', + 'BuildResultProvisioningState', + 'BuildServiceProvisioningState', + 'BuilderProvisioningState', + 'BuildpackBindingProvisioningState', + 'ConfigServerState', + 'ConfigurationServiceProvisioningState', + 'CreatedByType', + 'DeploymentResourceProvisioningState', + 'DeploymentResourceStatus', + 'GatewayProvisioningState', + 'KPackBuildStageProvisioningState', + 'LastModifiedByType', + 'ManagedIdentityType', + 'MonitoringSettingState', + 'PowerState', + 'ProvisioningState', + 'ResourceSkuRestrictionsReasonCode', + 'ResourceSkuRestrictionsType', + 'ServiceRegistryProvisioningState', + 'SkuScaleType', + 'SupportedRuntimePlatform', + 'SupportedRuntimeValue', + 'TestKeyType', + 'TrafficDirection', +] diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_01_01_preview/models/_app_platform_management_client_enums.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_01_01_preview/models/_app_platform_management_client_enums.py new file mode 100644 index 000000000000..1bada51e3be1 --- /dev/null +++ b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_01_01_preview/models/_app_platform_management_client_enums.py @@ -0,0 +1,274 @@ +# 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 ApiPortalProvisioningState(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): + """State of the API portal. + """ + + CREATING = "Creating" + UPDATING = "Updating" + SUCCEEDED = "Succeeded" + FAILED = "Failed" + DELETING = "Deleting" + +class AppResourceProvisioningState(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): + """Provisioning state of the App + """ + + SUCCEEDED = "Succeeded" + FAILED = "Failed" + CREATING = "Creating" + UPDATING = "Updating" + DELETING = "Deleting" + +class BindingType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): + """Buildpack Binding Type + """ + + APPLICATION_INSIGHTS = "ApplicationInsights" + APACHE_SKY_WALKING = "ApacheSkyWalking" + APP_DYNAMICS = "AppDynamics" + DYNATRACE = "Dynatrace" + NEW_RELIC = "NewRelic" + ELASTIC_APM = "ElasticAPM" + +class BuilderProvisioningState(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): + """Builder provision status. + """ + + CREATING = "Creating" + UPDATING = "Updating" + SUCCEEDED = "Succeeded" + FAILED = "Failed" + DELETING = "Deleting" + +class BuildpackBindingProvisioningState(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): + """State of the Buildpack Binding. + """ + + CREATING = "Creating" + UPDATING = "Updating" + SUCCEEDED = "Succeeded" + FAILED = "Failed" + DELETING = "Deleting" + +class BuildProvisioningState(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): + """Provisioning state of the KPack build result + """ + + CREATING = "Creating" + UPDATING = "Updating" + SUCCEEDED = "Succeeded" + FAILED = "Failed" + DELETING = "Deleting" + +class BuildResultProvisioningState(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): + """Provisioning state of the KPack build result + """ + + QUEUING = "Queuing" + BUILDING = "Building" + SUCCEEDED = "Succeeded" + FAILED = "Failed" + DELETING = "Deleting" + +class BuildServiceProvisioningState(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): + """Provisioning state of the KPack build result + """ + + CREATING = "Creating" + UPDATING = "Updating" + SUCCEEDED = "Succeeded" + FAILED = "Failed" + DELETING = "Deleting" + +class ConfigServerState(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): + """State of the config server. + """ + + NOT_AVAILABLE = "NotAvailable" + DELETED = "Deleted" + FAILED = "Failed" + SUCCEEDED = "Succeeded" + UPDATING = "Updating" + +class ConfigurationServiceProvisioningState(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): + """State of the Application Configuration Service. + """ + + CREATING = "Creating" + UPDATING = "Updating" + SUCCEEDED = "Succeeded" + FAILED = "Failed" + DELETING = "Deleting" + +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 + """ + + STOPPED = "Stopped" + RUNNING = "Running" + +class GatewayProvisioningState(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): + """State of the Spring Cloud Gateway. + """ + + CREATING = "Creating" + UPDATING = "Updating" + SUCCEEDED = "Succeeded" + FAILED = "Failed" + DELETING = "Deleting" + +class KPackBuildStageProvisioningState(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): + """The provisioning state of this build stage resource. + """ + + NOT_STARTED = "NotStarted" + RUNNING = "Running" + SUCCEEDED = "Succeeded" + FAILED = "Failed" + +class LastModifiedByType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): + """The type of identity that last modified the resource. + """ + + USER = "User" + APPLICATION = "Application" + MANAGED_IDENTITY = "ManagedIdentity" + KEY = "Key" + +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 ServiceRegistryProvisioningState(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): + """State of the Service Registry. + """ + + CREATING = "Creating" + UPDATING = "Updating" + SUCCEEDED = "Succeeded" + FAILED = "Failed" + DELETING = "Deleting" + +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" + JAVA17 = "Java_17" + 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" diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_01_01_preview/models/_models_py3.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_01_01_preview/models/_models_py3.py new file mode 100644 index 000000000000..6890fdae8509 --- /dev/null +++ b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_01_01_preview/models/_models_py3.py @@ -0,0 +1,7486 @@ +# 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 ActiveDeploymentCollection(msrest.serialization.Model): + """Object that includes an array of Deployment resource name and set them as active. + + :ivar active_deployment_names: Collection of Deployment name. + :vartype active_deployment_names: list[str] + """ + + _attribute_map = { + 'active_deployment_names': {'key': 'activeDeploymentNames', 'type': '[str]'}, + } + + def __init__( + self, + *, + active_deployment_names: Optional[List[str]] = None, + **kwargs + ): + """ + :keyword active_deployment_names: Collection of Deployment name. + :paramtype active_deployment_names: list[str] + """ + super(ActiveDeploymentCollection, self).__init__(**kwargs) + self.active_deployment_names = active_deployment_names + + +class ApiPortalCustomDomainProperties(msrest.serialization.Model): + """The properties of custom domain for API portal. + + :ivar thumbprint: The thumbprint of bound certificate. + :vartype thumbprint: str + """ + + _attribute_map = { + 'thumbprint': {'key': 'thumbprint', 'type': 'str'}, + } + + def __init__( + self, + *, + thumbprint: Optional[str] = None, + **kwargs + ): + """ + :keyword thumbprint: The thumbprint of bound certificate. + :paramtype thumbprint: str + """ + super(ApiPortalCustomDomainProperties, self).__init__(**kwargs) + self.thumbprint = thumbprint + + +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 + :ivar system_data: Metadata pertaining to creation and last modification of the resource. + :vartype system_data: ~azure.mgmt.appplatform.v2022_01_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'}, + 'system_data': {'key': 'systemData', 'type': 'SystemData'}, + } + + def __init__( + self, + **kwargs + ): + """ + """ + super(Resource, self).__init__(**kwargs) + self.id = None + self.name = None + self.type = None + self.system_data = 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 + :ivar system_data: Metadata pertaining to creation and last modification of the resource. + :vartype system_data: ~azure.mgmt.appplatform.v2022_01_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'}, + 'system_data': {'key': 'systemData', 'type': 'SystemData'}, + } + + def __init__( + self, + **kwargs + ): + """ + """ + super(ProxyResource, self).__init__(**kwargs) + + +class ApiPortalCustomDomainResource(ProxyResource): + """Custom domain of the API portal. + + 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 system_data: Metadata pertaining to creation and last modification of the resource. + :vartype system_data: ~azure.mgmt.appplatform.v2022_01_01_preview.models.SystemData + :ivar properties: The properties of custom domain for API portal. + :vartype properties: + ~azure.mgmt.appplatform.v2022_01_01_preview.models.ApiPortalCustomDomainProperties + """ + + _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'}, + 'system_data': {'key': 'systemData', 'type': 'SystemData'}, + 'properties': {'key': 'properties', 'type': 'ApiPortalCustomDomainProperties'}, + } + + def __init__( + self, + *, + properties: Optional["ApiPortalCustomDomainProperties"] = None, + **kwargs + ): + """ + :keyword properties: The properties of custom domain for API portal. + :paramtype properties: + ~azure.mgmt.appplatform.v2022_01_01_preview.models.ApiPortalCustomDomainProperties + """ + super(ApiPortalCustomDomainResource, self).__init__(**kwargs) + self.properties = properties + + +class ApiPortalCustomDomainResourceCollection(msrest.serialization.Model): + """Object that includes an array of API portal custom domain resources and a possible link for next set. + + :ivar value: Collection of API portal custom domain resources. + :vartype value: + list[~azure.mgmt.appplatform.v2022_01_01_preview.models.ApiPortalCustomDomainResource] + :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': '[ApiPortalCustomDomainResource]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + *, + value: Optional[List["ApiPortalCustomDomainResource"]] = None, + next_link: Optional[str] = None, + **kwargs + ): + """ + :keyword value: Collection of API portal custom domain resources. + :paramtype value: + list[~azure.mgmt.appplatform.v2022_01_01_preview.models.ApiPortalCustomDomainResource] + :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(ApiPortalCustomDomainResourceCollection, self).__init__(**kwargs) + self.value = value + self.next_link = next_link + + +class ApiPortalInstance(msrest.serialization.Model): + """Collection of instances belong to the API portal. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar name: Name of the API portal instance. + :vartype name: str + :ivar status: Status of the API portal instance. + :vartype status: str + """ + + _validation = { + 'name': {'readonly': True}, + 'status': {'readonly': True}, + } + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'status': {'key': 'status', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + """ + """ + super(ApiPortalInstance, self).__init__(**kwargs) + self.name = None + self.status = None + + +class ApiPortalProperties(msrest.serialization.Model): + """API portal properties payload. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar provisioning_state: State of the API portal. Possible values include: "Creating", + "Updating", "Succeeded", "Failed", "Deleting". + :vartype provisioning_state: str or + ~azure.mgmt.appplatform.v2022_01_01_preview.models.ApiPortalProvisioningState + :ivar public: Indicates whether the API portal exposes endpoint. + :vartype public: bool + :ivar url: URL of the API portal, exposed when 'public' is true. + :vartype url: str + :ivar https_only: Indicate if only https is allowed. + :vartype https_only: bool + :ivar gateway_ids: The array of resource Ids of gateway to integrate with API portal. + :vartype gateway_ids: list[str] + :ivar source_urls: Collection of OpenAPI source URL locations. + :vartype source_urls: list[str] + :ivar sso_properties: Single sign-on related configuration. + :vartype sso_properties: ~azure.mgmt.appplatform.v2022_01_01_preview.models.SsoProperties + :ivar resource_requests: The requested resource quantity for required CPU and Memory. + :vartype resource_requests: + ~azure.mgmt.appplatform.v2022_01_01_preview.models.ApiPortalResourceRequests + :ivar instances: Collection of instances belong to API portal. + :vartype instances: list[~azure.mgmt.appplatform.v2022_01_01_preview.models.ApiPortalInstance] + """ + + _validation = { + 'provisioning_state': {'readonly': True}, + 'url': {'readonly': True}, + 'resource_requests': {'readonly': True}, + 'instances': {'readonly': True}, + } + + _attribute_map = { + 'provisioning_state': {'key': 'provisioningState', 'type': 'str'}, + 'public': {'key': 'public', 'type': 'bool'}, + 'url': {'key': 'url', 'type': 'str'}, + 'https_only': {'key': 'httpsOnly', 'type': 'bool'}, + 'gateway_ids': {'key': 'gatewayIds', 'type': '[str]'}, + 'source_urls': {'key': 'sourceUrls', 'type': '[str]'}, + 'sso_properties': {'key': 'ssoProperties', 'type': 'SsoProperties'}, + 'resource_requests': {'key': 'resourceRequests', 'type': 'ApiPortalResourceRequests'}, + 'instances': {'key': 'instances', 'type': '[ApiPortalInstance]'}, + } + + def __init__( + self, + *, + public: Optional[bool] = None, + https_only: Optional[bool] = None, + gateway_ids: Optional[List[str]] = None, + source_urls: Optional[List[str]] = None, + sso_properties: Optional["SsoProperties"] = None, + **kwargs + ): + """ + :keyword public: Indicates whether the API portal exposes endpoint. + :paramtype public: bool + :keyword https_only: Indicate if only https is allowed. + :paramtype https_only: bool + :keyword gateway_ids: The array of resource Ids of gateway to integrate with API portal. + :paramtype gateway_ids: list[str] + :keyword source_urls: Collection of OpenAPI source URL locations. + :paramtype source_urls: list[str] + :keyword sso_properties: Single sign-on related configuration. + :paramtype sso_properties: ~azure.mgmt.appplatform.v2022_01_01_preview.models.SsoProperties + """ + super(ApiPortalProperties, self).__init__(**kwargs) + self.provisioning_state = None + self.public = public + self.url = None + self.https_only = https_only + self.gateway_ids = gateway_ids + self.source_urls = source_urls + self.sso_properties = sso_properties + self.resource_requests = None + self.instances = None + + +class ApiPortalResource(ProxyResource): + """API portal 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 system_data: Metadata pertaining to creation and last modification of the resource. + :vartype system_data: ~azure.mgmt.appplatform.v2022_01_01_preview.models.SystemData + :ivar properties: API portal properties payload. + :vartype properties: ~azure.mgmt.appplatform.v2022_01_01_preview.models.ApiPortalProperties + :ivar sku: Sku of the API portal resource. + :vartype sku: ~azure.mgmt.appplatform.v2022_01_01_preview.models.Sku + """ + + _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'}, + 'system_data': {'key': 'systemData', 'type': 'SystemData'}, + 'properties': {'key': 'properties', 'type': 'ApiPortalProperties'}, + 'sku': {'key': 'sku', 'type': 'Sku'}, + } + + def __init__( + self, + *, + properties: Optional["ApiPortalProperties"] = None, + sku: Optional["Sku"] = None, + **kwargs + ): + """ + :keyword properties: API portal properties payload. + :paramtype properties: ~azure.mgmt.appplatform.v2022_01_01_preview.models.ApiPortalProperties + :keyword sku: Sku of the API portal resource. + :paramtype sku: ~azure.mgmt.appplatform.v2022_01_01_preview.models.Sku + """ + super(ApiPortalResource, self).__init__(**kwargs) + self.properties = properties + self.sku = sku + + +class ApiPortalResourceCollection(msrest.serialization.Model): + """Object that includes an array of API portal resources and a possible link for next set. + + :ivar value: Collection of API portal resources. + :vartype value: list[~azure.mgmt.appplatform.v2022_01_01_preview.models.ApiPortalResource] + :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': '[ApiPortalResource]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + *, + value: Optional[List["ApiPortalResource"]] = None, + next_link: Optional[str] = None, + **kwargs + ): + """ + :keyword value: Collection of API portal resources. + :paramtype value: list[~azure.mgmt.appplatform.v2022_01_01_preview.models.ApiPortalResource] + :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(ApiPortalResourceCollection, self).__init__(**kwargs) + self.value = value + self.next_link = next_link + + +class ApiPortalResourceRequests(msrest.serialization.Model): + """Resource requests of the API portal. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar cpu: Cpu allocated to each API portal instance. + :vartype cpu: str + :ivar memory: Memory allocated to each API portal instance. + :vartype memory: str + """ + + _validation = { + 'cpu': {'readonly': True}, + 'memory': {'readonly': True}, + } + + _attribute_map = { + 'cpu': {'key': 'cpu', 'type': 'str'}, + 'memory': {'key': 'memory', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + """ + """ + super(ApiPortalResourceRequests, self).__init__(**kwargs) + self.cpu = None + self.memory = None + + +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 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 system_data: Metadata pertaining to creation and last modification of the resource. + :vartype system_data: ~azure.mgmt.appplatform.v2022_01_01_preview.models.SystemData + :ivar properties: Properties of the App resource. + :vartype properties: ~azure.mgmt.appplatform.v2022_01_01_preview.models.AppResourceProperties + :ivar identity: The Managed Identity type of the app resource. + :vartype identity: ~azure.mgmt.appplatform.v2022_01_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}, + 'system_data': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'system_data': {'key': 'systemData', 'type': 'SystemData'}, + '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.v2022_01_01_preview.models.AppResourceProperties + :keyword identity: The Managed Identity type of the app resource. + :paramtype identity: + ~azure.mgmt.appplatform.v2022_01_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.v2022_01_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.v2022_01_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 addon_configs: Collection of addons. + :vartype addon_configs: dict[str, dict[str, any]] + :ivar provisioning_state: Provisioning state of the App. Possible values include: "Succeeded", + "Failed", "Creating", "Updating", "Deleting". + :vartype provisioning_state: str or + ~azure.mgmt.appplatform.v2022_01_01_preview.models.AppResourceProvisioningState + :ivar fqdn: Fully qualified dns Name. + :vartype fqdn: str + :ivar https_only: Indicate if only https is allowed. + :vartype https_only: bool + :ivar temporary_disk: Temporary disk settings. + :vartype temporary_disk: ~azure.mgmt.appplatform.v2022_01_01_preview.models.TemporaryDisk + :ivar persistent_disk: Persistent disk settings. + :vartype persistent_disk: ~azure.mgmt.appplatform.v2022_01_01_preview.models.PersistentDisk + :ivar custom_persistent_disks: List of custom persistent disks. + :vartype custom_persistent_disks: + list[~azure.mgmt.appplatform.v2022_01_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.v2022_01_01_preview.models.LoadedCertificate] + """ + + _validation = { + 'url': {'readonly': True}, + 'provisioning_state': {'readonly': True}, + } + + _attribute_map = { + 'public': {'key': 'public', 'type': 'bool'}, + 'url': {'key': 'url', 'type': 'str'}, + 'addon_configs': {'key': 'addonConfigs', 'type': '{{object}}'}, + 'provisioning_state': {'key': 'provisioningState', 'type': 'str'}, + 'fqdn': {'key': 'fqdn', 'type': 'str'}, + 'https_only': {'key': 'httpsOnly', 'type': 'bool'}, + '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, + addon_configs: Optional[Dict[str, Dict[str, Any]]] = 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 addon_configs: Collection of addons. + :paramtype addon_configs: dict[str, dict[str, any]] + :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.v2022_01_01_preview.models.TemporaryDisk + :keyword persistent_disk: Persistent disk settings. + :paramtype persistent_disk: ~azure.mgmt.appplatform.v2022_01_01_preview.models.PersistentDisk + :keyword custom_persistent_disks: List of custom persistent disks. + :paramtype custom_persistent_disks: + list[~azure.mgmt.appplatform.v2022_01_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.v2022_01_01_preview.models.LoadedCertificate] + """ + super(AppResourceProperties, self).__init__(**kwargs) + self.public = public + self.url = None + self.addon_configs = addon_configs + self.provisioning_state = None + self.fqdn = fqdn + self.https_only = https_only + 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.v2022_01_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.v2022_01_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.v2022_01_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 system_data: Metadata pertaining to creation and last modification of the resource. + :vartype system_data: ~azure.mgmt.appplatform.v2022_01_01_preview.models.SystemData + :ivar properties: Properties of the Binding resource. + :vartype properties: + ~azure.mgmt.appplatform.v2022_01_01_preview.models.BindingResourceProperties + """ + + _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'}, + 'system_data': {'key': 'systemData', 'type': 'SystemData'}, + '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.v2022_01_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.v2022_01_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.v2022_01_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 Build(ProxyResource): + """Build 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 system_data: Metadata pertaining to creation and last modification of the resource. + :vartype system_data: ~azure.mgmt.appplatform.v2022_01_01_preview.models.SystemData + :ivar properties: Properties of the build resource. + :vartype properties: ~azure.mgmt.appplatform.v2022_01_01_preview.models.BuildProperties + """ + + _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'}, + 'system_data': {'key': 'systemData', 'type': 'SystemData'}, + 'properties': {'key': 'properties', 'type': 'BuildProperties'}, + } + + def __init__( + self, + *, + properties: Optional["BuildProperties"] = None, + **kwargs + ): + """ + :keyword properties: Properties of the build resource. + :paramtype properties: ~azure.mgmt.appplatform.v2022_01_01_preview.models.BuildProperties + """ + super(Build, self).__init__(**kwargs) + self.properties = properties + + +class BuildCollection(msrest.serialization.Model): + """Object that includes an array of Build resources and a possible link for next set. + + :ivar value: Collection of Build resources. + :vartype value: list[~azure.mgmt.appplatform.v2022_01_01_preview.models.Build] + :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': '[Build]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + *, + value: Optional[List["Build"]] = None, + next_link: Optional[str] = None, + **kwargs + ): + """ + :keyword value: Collection of Build resources. + :paramtype value: list[~azure.mgmt.appplatform.v2022_01_01_preview.models.Build] + :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(BuildCollection, self).__init__(**kwargs) + self.value = value + self.next_link = next_link + + +class BuilderProperties(msrest.serialization.Model): + """KPack Builder properties payload. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar provisioning_state: Builder provision status. Possible values include: "Creating", + "Updating", "Succeeded", "Failed", "Deleting". + :vartype provisioning_state: str or + ~azure.mgmt.appplatform.v2022_01_01_preview.models.BuilderProvisioningState + :ivar stack: Builder cluster stack property. + :vartype stack: ~azure.mgmt.appplatform.v2022_01_01_preview.models.StackProperties + :ivar buildpack_groups: Builder buildpack groups. + :vartype buildpack_groups: + list[~azure.mgmt.appplatform.v2022_01_01_preview.models.BuildpacksGroupProperties] + """ + + _validation = { + 'provisioning_state': {'readonly': True}, + } + + _attribute_map = { + 'provisioning_state': {'key': 'provisioningState', 'type': 'str'}, + 'stack': {'key': 'stack', 'type': 'StackProperties'}, + 'buildpack_groups': {'key': 'buildpackGroups', 'type': '[BuildpacksGroupProperties]'}, + } + + def __init__( + self, + *, + stack: Optional["StackProperties"] = None, + buildpack_groups: Optional[List["BuildpacksGroupProperties"]] = None, + **kwargs + ): + """ + :keyword stack: Builder cluster stack property. + :paramtype stack: ~azure.mgmt.appplatform.v2022_01_01_preview.models.StackProperties + :keyword buildpack_groups: Builder buildpack groups. + :paramtype buildpack_groups: + list[~azure.mgmt.appplatform.v2022_01_01_preview.models.BuildpacksGroupProperties] + """ + super(BuilderProperties, self).__init__(**kwargs) + self.provisioning_state = None + self.stack = stack + self.buildpack_groups = buildpack_groups + + +class BuilderResource(ProxyResource): + """KPack Builder 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 system_data: Metadata pertaining to creation and last modification of the resource. + :vartype system_data: ~azure.mgmt.appplatform.v2022_01_01_preview.models.SystemData + :ivar properties: Property of the Builder resource. + :vartype properties: ~azure.mgmt.appplatform.v2022_01_01_preview.models.BuilderProperties + """ + + _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'}, + 'system_data': {'key': 'systemData', 'type': 'SystemData'}, + 'properties': {'key': 'properties', 'type': 'BuilderProperties'}, + } + + def __init__( + self, + *, + properties: Optional["BuilderProperties"] = None, + **kwargs + ): + """ + :keyword properties: Property of the Builder resource. + :paramtype properties: ~azure.mgmt.appplatform.v2022_01_01_preview.models.BuilderProperties + """ + super(BuilderResource, self).__init__(**kwargs) + self.properties = properties + + +class BuilderResourceCollection(msrest.serialization.Model): + """Object that includes an array of Builder resources and a possible link for next set. + + :ivar value: Collection of Builder resources. + :vartype value: list[~azure.mgmt.appplatform.v2022_01_01_preview.models.BuilderResource] + :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': '[BuilderResource]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + *, + value: Optional[List["BuilderResource"]] = None, + next_link: Optional[str] = None, + **kwargs + ): + """ + :keyword value: Collection of Builder resources. + :paramtype value: list[~azure.mgmt.appplatform.v2022_01_01_preview.models.BuilderResource] + :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(BuilderResourceCollection, self).__init__(**kwargs) + self.value = value + self.next_link = next_link + + +class BuildpackBindingLaunchProperties(msrest.serialization.Model): + """Buildpack Binding Launch Properties. + + :ivar properties: Non-sensitive properties for launchProperties. + :vartype properties: dict[str, str] + :ivar secrets: Sensitive properties for launchProperties. + :vartype secrets: dict[str, str] + """ + + _attribute_map = { + 'properties': {'key': 'properties', 'type': '{str}'}, + 'secrets': {'key': 'secrets', 'type': '{str}'}, + } + + def __init__( + self, + *, + properties: Optional[Dict[str, str]] = None, + secrets: Optional[Dict[str, str]] = None, + **kwargs + ): + """ + :keyword properties: Non-sensitive properties for launchProperties. + :paramtype properties: dict[str, str] + :keyword secrets: Sensitive properties for launchProperties. + :paramtype secrets: dict[str, str] + """ + super(BuildpackBindingLaunchProperties, self).__init__(**kwargs) + self.properties = properties + self.secrets = secrets + + +class BuildpackBindingProperties(msrest.serialization.Model): + """Properties of a buildpack binding. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar binding_type: Buildpack Binding Type. Possible values include: "ApplicationInsights", + "ApacheSkyWalking", "AppDynamics", "Dynatrace", "NewRelic", "ElasticAPM". + :vartype binding_type: str or ~azure.mgmt.appplatform.v2022_01_01_preview.models.BindingType + :ivar provisioning_state: State of the Buildpack Binding. Possible values include: "Creating", + "Updating", "Succeeded", "Failed", "Deleting". + :vartype provisioning_state: str or + ~azure.mgmt.appplatform.v2022_01_01_preview.models.BuildpackBindingProvisioningState + :ivar launch_properties: The object describes the buildpack binding launch properties. + :vartype launch_properties: + ~azure.mgmt.appplatform.v2022_01_01_preview.models.BuildpackBindingLaunchProperties + """ + + _validation = { + 'provisioning_state': {'readonly': True}, + } + + _attribute_map = { + 'binding_type': {'key': 'bindingType', 'type': 'str'}, + 'provisioning_state': {'key': 'provisioningState', 'type': 'str'}, + 'launch_properties': {'key': 'launchProperties', 'type': 'BuildpackBindingLaunchProperties'}, + } + + def __init__( + self, + *, + binding_type: Optional[Union[str, "BindingType"]] = None, + launch_properties: Optional["BuildpackBindingLaunchProperties"] = None, + **kwargs + ): + """ + :keyword binding_type: Buildpack Binding Type. Possible values include: "ApplicationInsights", + "ApacheSkyWalking", "AppDynamics", "Dynatrace", "NewRelic", "ElasticAPM". + :paramtype binding_type: str or ~azure.mgmt.appplatform.v2022_01_01_preview.models.BindingType + :keyword launch_properties: The object describes the buildpack binding launch properties. + :paramtype launch_properties: + ~azure.mgmt.appplatform.v2022_01_01_preview.models.BuildpackBindingLaunchProperties + """ + super(BuildpackBindingProperties, self).__init__(**kwargs) + self.binding_type = binding_type + self.provisioning_state = None + self.launch_properties = launch_properties + + +class BuildpackBindingResource(ProxyResource): + """Buildpack Binding Resource object. + + 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 system_data: Metadata pertaining to creation and last modification of the resource. + :vartype system_data: ~azure.mgmt.appplatform.v2022_01_01_preview.models.SystemData + :ivar properties: Properties of a buildpack binding. + :vartype properties: + ~azure.mgmt.appplatform.v2022_01_01_preview.models.BuildpackBindingProperties + """ + + _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'}, + 'system_data': {'key': 'systemData', 'type': 'SystemData'}, + 'properties': {'key': 'properties', 'type': 'BuildpackBindingProperties'}, + } + + def __init__( + self, + *, + properties: Optional["BuildpackBindingProperties"] = None, + **kwargs + ): + """ + :keyword properties: Properties of a buildpack binding. + :paramtype properties: + ~azure.mgmt.appplatform.v2022_01_01_preview.models.BuildpackBindingProperties + """ + super(BuildpackBindingResource, self).__init__(**kwargs) + self.properties = properties + + +class BuildpackBindingResourceCollection(msrest.serialization.Model): + """Object that includes an array of BuildpackBinding resources and a possible link for next set. + + :ivar value: Collection of BuildpackBinding resources. + :vartype value: + list[~azure.mgmt.appplatform.v2022_01_01_preview.models.BuildpackBindingResource] + :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': '[BuildpackBindingResource]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + *, + value: Optional[List["BuildpackBindingResource"]] = None, + next_link: Optional[str] = None, + **kwargs + ): + """ + :keyword value: Collection of BuildpackBinding resources. + :paramtype value: + list[~azure.mgmt.appplatform.v2022_01_01_preview.models.BuildpackBindingResource] + :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(BuildpackBindingResourceCollection, self).__init__(**kwargs) + self.value = value + self.next_link = next_link + + +class BuildpackProperties(msrest.serialization.Model): + """Buildpack properties payload. + + :ivar id: Id of the buildpack. + :vartype id: str + """ + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + } + + def __init__( + self, + *, + id: Optional[str] = None, + **kwargs + ): + """ + :keyword id: Id of the buildpack. + :paramtype id: str + """ + super(BuildpackProperties, self).__init__(**kwargs) + self.id = id + + +class BuildpacksGroupProperties(msrest.serialization.Model): + """Buildpack group properties of the Builder. + + :ivar name: Buildpack group name. + :vartype name: str + :ivar buildpacks: Buildpacks in the buildpack group. + :vartype buildpacks: + list[~azure.mgmt.appplatform.v2022_01_01_preview.models.BuildpackProperties] + """ + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'buildpacks': {'key': 'buildpacks', 'type': '[BuildpackProperties]'}, + } + + def __init__( + self, + *, + name: Optional[str] = None, + buildpacks: Optional[List["BuildpackProperties"]] = None, + **kwargs + ): + """ + :keyword name: Buildpack group name. + :paramtype name: str + :keyword buildpacks: Buildpacks in the buildpack group. + :paramtype buildpacks: + list[~azure.mgmt.appplatform.v2022_01_01_preview.models.BuildpackProperties] + """ + super(BuildpacksGroupProperties, self).__init__(**kwargs) + self.name = name + self.buildpacks = buildpacks + + +class BuildProperties(msrest.serialization.Model): + """Build resource properties payload. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar relative_path: The relative path of source code. + :vartype relative_path: str + :ivar builder: The resource id of builder to build the source code. + :vartype builder: str + :ivar agent_pool: The resource id of agent pool. + :vartype agent_pool: str + :ivar provisioning_state: Provisioning state of the KPack build result. Possible values + include: "Creating", "Updating", "Succeeded", "Failed", "Deleting". + :vartype provisioning_state: str or + ~azure.mgmt.appplatform.v2022_01_01_preview.models.BuildProvisioningState + :ivar env: The environment variables for this build. + :vartype env: dict[str, str] + :ivar triggered_build_result: The build result triggered by this build. + :vartype triggered_build_result: + ~azure.mgmt.appplatform.v2022_01_01_preview.models.TriggeredBuildResult + """ + + _validation = { + 'provisioning_state': {'readonly': True}, + 'triggered_build_result': {'readonly': True}, + } + + _attribute_map = { + 'relative_path': {'key': 'relativePath', 'type': 'str'}, + 'builder': {'key': 'builder', 'type': 'str'}, + 'agent_pool': {'key': 'agentPool', 'type': 'str'}, + 'provisioning_state': {'key': 'provisioningState', 'type': 'str'}, + 'env': {'key': 'env', 'type': '{str}'}, + 'triggered_build_result': {'key': 'triggeredBuildResult', 'type': 'TriggeredBuildResult'}, + } + + def __init__( + self, + *, + relative_path: Optional[str] = None, + builder: Optional[str] = None, + agent_pool: Optional[str] = None, + env: Optional[Dict[str, str]] = None, + **kwargs + ): + """ + :keyword relative_path: The relative path of source code. + :paramtype relative_path: str + :keyword builder: The resource id of builder to build the source code. + :paramtype builder: str + :keyword agent_pool: The resource id of agent pool. + :paramtype agent_pool: str + :keyword env: The environment variables for this build. + :paramtype env: dict[str, str] + """ + super(BuildProperties, self).__init__(**kwargs) + self.relative_path = relative_path + self.builder = builder + self.agent_pool = agent_pool + self.provisioning_state = None + self.env = env + self.triggered_build_result = None + + +class BuildResult(ProxyResource): + """Build result 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 system_data: Metadata pertaining to creation and last modification of the resource. + :vartype system_data: ~azure.mgmt.appplatform.v2022_01_01_preview.models.SystemData + :ivar properties: Properties of the build result resource. + :vartype properties: ~azure.mgmt.appplatform.v2022_01_01_preview.models.BuildResultProperties + """ + + _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'}, + 'system_data': {'key': 'systemData', 'type': 'SystemData'}, + 'properties': {'key': 'properties', 'type': 'BuildResultProperties'}, + } + + def __init__( + self, + *, + properties: Optional["BuildResultProperties"] = None, + **kwargs + ): + """ + :keyword properties: Properties of the build result resource. + :paramtype properties: ~azure.mgmt.appplatform.v2022_01_01_preview.models.BuildResultProperties + """ + super(BuildResult, self).__init__(**kwargs) + self.properties = properties + + +class BuildResultCollection(msrest.serialization.Model): + """Object that includes an array of Build result resources and a possible link for next set. + + :ivar value: Collection of Build result resources. + :vartype value: list[~azure.mgmt.appplatform.v2022_01_01_preview.models.BuildResult] + :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': '[BuildResult]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + *, + value: Optional[List["BuildResult"]] = None, + next_link: Optional[str] = None, + **kwargs + ): + """ + :keyword value: Collection of Build result resources. + :paramtype value: list[~azure.mgmt.appplatform.v2022_01_01_preview.models.BuildResult] + :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(BuildResultCollection, self).__init__(**kwargs) + self.value = value + self.next_link = next_link + + +class BuildResultLog(msrest.serialization.Model): + """Build result log resource properties payload. + + :ivar blob_url: The public download URL of this build result log. + :vartype blob_url: str + """ + + _attribute_map = { + 'blob_url': {'key': 'blobUrl', 'type': 'str'}, + } + + def __init__( + self, + *, + blob_url: Optional[str] = None, + **kwargs + ): + """ + :keyword blob_url: The public download URL of this build result log. + :paramtype blob_url: str + """ + super(BuildResultLog, self).__init__(**kwargs) + self.blob_url = blob_url + + +class BuildResultProperties(msrest.serialization.Model): + """Build result resource properties payload. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar name: The name of this build result. + :vartype name: str + :ivar provisioning_state: Provisioning state of the KPack build result. Possible values + include: "Queuing", "Building", "Succeeded", "Failed", "Deleting". + :vartype provisioning_state: str or + ~azure.mgmt.appplatform.v2022_01_01_preview.models.BuildResultProvisioningState + :ivar build_pod_name: The build pod name which can be used to get the build log streaming. + :vartype build_pod_name: str + :ivar build_stages: All of the build stage (init-container and container) resources in build + pod. + :vartype build_stages: + list[~azure.mgmt.appplatform.v2022_01_01_preview.models.BuildStageProperties] + """ + + _validation = { + 'provisioning_state': {'readonly': True}, + 'build_stages': {'readonly': True}, + } + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'provisioning_state': {'key': 'provisioningState', 'type': 'str'}, + 'build_pod_name': {'key': 'buildPodName', 'type': 'str'}, + 'build_stages': {'key': 'buildStages', 'type': '[BuildStageProperties]'}, + } + + def __init__( + self, + *, + name: Optional[str] = None, + build_pod_name: Optional[str] = None, + **kwargs + ): + """ + :keyword name: The name of this build result. + :paramtype name: str + :keyword build_pod_name: The build pod name which can be used to get the build log streaming. + :paramtype build_pod_name: str + """ + super(BuildResultProperties, self).__init__(**kwargs) + self.name = name + self.provisioning_state = None + self.build_pod_name = build_pod_name + self.build_stages = None + + +class UserSourceInfo(msrest.serialization.Model): + """Source information for a deployment. + + You probably want to use the sub-classes and not this class directly. Known + sub-classes are: BuildResultUserSourceInfo, CustomContainerUserSourceInfo, UploadedUserSourceInfo. + + All required parameters must be populated in order to send to Azure. + + :ivar type: Required. Type of the source uploaded.Constant filled by server. + :vartype type: str + :ivar version: Version of the source. + :vartype version: str + """ + + _validation = { + 'type': {'required': True}, + } + + _attribute_map = { + 'type': {'key': 'type', 'type': 'str'}, + 'version': {'key': 'version', 'type': 'str'}, + } + + _subtype_map = { + 'type': {'BuildResult': 'BuildResultUserSourceInfo', 'Container': 'CustomContainerUserSourceInfo', 'UploadedUserSourceInfo': 'UploadedUserSourceInfo'} + } + + def __init__( + self, + *, + version: Optional[str] = None, + **kwargs + ): + """ + :keyword version: Version of the source. + :paramtype version: str + """ + super(UserSourceInfo, self).__init__(**kwargs) + self.type = None # type: Optional[str] + self.version = version + + +class BuildResultUserSourceInfo(UserSourceInfo): + """Reference to a build result. + + All required parameters must be populated in order to send to Azure. + + :ivar type: Required. Type of the source uploaded.Constant filled by server. + :vartype type: str + :ivar version: Version of the source. + :vartype version: str + :ivar build_result_id: Resource id of an existing succeeded build result under the same Spring + instance. + :vartype build_result_id: str + """ + + _validation = { + 'type': {'required': True}, + } + + _attribute_map = { + 'type': {'key': 'type', 'type': 'str'}, + 'version': {'key': 'version', 'type': 'str'}, + 'build_result_id': {'key': 'buildResultId', 'type': 'str'}, + } + + def __init__( + self, + *, + version: Optional[str] = None, + build_result_id: Optional[str] = None, + **kwargs + ): + """ + :keyword version: Version of the source. + :paramtype version: str + :keyword build_result_id: Resource id of an existing succeeded build result under the same + Spring instance. + :paramtype build_result_id: str + """ + super(BuildResultUserSourceInfo, self).__init__(version=version, **kwargs) + self.type = 'BuildResult' # type: str + self.build_result_id = build_result_id + + +class BuildService(ProxyResource): + """Build service 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 system_data: Metadata pertaining to creation and last modification of the resource. + :vartype system_data: ~azure.mgmt.appplatform.v2022_01_01_preview.models.SystemData + :ivar properties: Properties of the build resource. + :vartype properties: ~azure.mgmt.appplatform.v2022_01_01_preview.models.BuildServiceProperties + """ + + _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'}, + 'system_data': {'key': 'systemData', 'type': 'SystemData'}, + 'properties': {'key': 'properties', 'type': 'BuildServiceProperties'}, + } + + def __init__( + self, + *, + properties: Optional["BuildServiceProperties"] = None, + **kwargs + ): + """ + :keyword properties: Properties of the build resource. + :paramtype properties: + ~azure.mgmt.appplatform.v2022_01_01_preview.models.BuildServiceProperties + """ + super(BuildService, self).__init__(**kwargs) + self.properties = properties + + +class BuildServiceAgentPoolProperties(msrest.serialization.Model): + """Build service agent pool properties. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar provisioning_state: Provisioning state of the build service agent pool. + :vartype provisioning_state: str + :ivar pool_size: build service agent pool size properties. + :vartype pool_size: + ~azure.mgmt.appplatform.v2022_01_01_preview.models.BuildServiceAgentPoolSizeProperties + """ + + _validation = { + 'provisioning_state': {'readonly': True}, + } + + _attribute_map = { + 'provisioning_state': {'key': 'provisioningState', 'type': 'str'}, + 'pool_size': {'key': 'poolSize', 'type': 'BuildServiceAgentPoolSizeProperties'}, + } + + def __init__( + self, + *, + pool_size: Optional["BuildServiceAgentPoolSizeProperties"] = None, + **kwargs + ): + """ + :keyword pool_size: build service agent pool size properties. + :paramtype pool_size: + ~azure.mgmt.appplatform.v2022_01_01_preview.models.BuildServiceAgentPoolSizeProperties + """ + super(BuildServiceAgentPoolProperties, self).__init__(**kwargs) + self.provisioning_state = None + self.pool_size = pool_size + + +class BuildServiceAgentPoolResource(ProxyResource): + """The build service agent pool 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 system_data: Metadata pertaining to creation and last modification of the resource. + :vartype system_data: ~azure.mgmt.appplatform.v2022_01_01_preview.models.SystemData + :ivar properties: build service agent pool properties. + :vartype properties: + ~azure.mgmt.appplatform.v2022_01_01_preview.models.BuildServiceAgentPoolProperties + """ + + _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'}, + 'system_data': {'key': 'systemData', 'type': 'SystemData'}, + 'properties': {'key': 'properties', 'type': 'BuildServiceAgentPoolProperties'}, + } + + def __init__( + self, + *, + properties: Optional["BuildServiceAgentPoolProperties"] = None, + **kwargs + ): + """ + :keyword properties: build service agent pool properties. + :paramtype properties: + ~azure.mgmt.appplatform.v2022_01_01_preview.models.BuildServiceAgentPoolProperties + """ + super(BuildServiceAgentPoolResource, self).__init__(**kwargs) + self.properties = properties + + +class BuildServiceAgentPoolResourceCollection(msrest.serialization.Model): + """Object that includes an array of build service agent pool resources and a possible link for next set. + + :ivar value: Collection of build service agent pool resource. + :vartype value: + list[~azure.mgmt.appplatform.v2022_01_01_preview.models.BuildServiceAgentPoolResource] + :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': '[BuildServiceAgentPoolResource]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + *, + value: Optional[List["BuildServiceAgentPoolResource"]] = None, + next_link: Optional[str] = None, + **kwargs + ): + """ + :keyword value: Collection of build service agent pool resource. + :paramtype value: + list[~azure.mgmt.appplatform.v2022_01_01_preview.models.BuildServiceAgentPoolResource] + :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(BuildServiceAgentPoolResourceCollection, self).__init__(**kwargs) + self.value = value + self.next_link = next_link + + +class BuildServiceAgentPoolSizeProperties(msrest.serialization.Model): + """Build service agent pool size properties. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar name: The name of build service agent pool size. + :vartype name: str + :ivar cpu: The cpu property of build service agent pool size. + :vartype cpu: str + :ivar memory: The memory property of build service agent pool size. + :vartype memory: str + """ + + _validation = { + 'cpu': {'readonly': True}, + 'memory': {'readonly': True}, + } + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'cpu': {'key': 'cpu', 'type': 'str'}, + 'memory': {'key': 'memory', 'type': 'str'}, + } + + def __init__( + self, + *, + name: Optional[str] = None, + **kwargs + ): + """ + :keyword name: The name of build service agent pool size. + :paramtype name: str + """ + super(BuildServiceAgentPoolSizeProperties, self).__init__(**kwargs) + self.name = name + self.cpu = None + self.memory = None + + +class BuildServiceCollection(msrest.serialization.Model): + """Object that includes an array of Build service resources and a possible link for next set. + + :ivar value: Collection of Build service resources. + :vartype value: list[~azure.mgmt.appplatform.v2022_01_01_preview.models.BuildService] + :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': '[BuildService]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + *, + value: Optional[List["BuildService"]] = None, + next_link: Optional[str] = None, + **kwargs + ): + """ + :keyword value: Collection of Build service resources. + :paramtype value: list[~azure.mgmt.appplatform.v2022_01_01_preview.models.BuildService] + :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(BuildServiceCollection, self).__init__(**kwargs) + self.value = value + self.next_link = next_link + + +class BuildServiceProperties(msrest.serialization.Model): + """Build service resource properties payload. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar k_pack_version: The installed KPack version in this build service. + :vartype k_pack_version: str + :ivar provisioning_state: Provisioning state of the KPack build result. Possible values + include: "Creating", "Updating", "Succeeded", "Failed", "Deleting". + :vartype provisioning_state: str or + ~azure.mgmt.appplatform.v2022_01_01_preview.models.BuildServiceProvisioningState + :ivar resource_requests: The runtime resource configuration of this build service. + :vartype resource_requests: + ~azure.mgmt.appplatform.v2022_01_01_preview.models.BuildServicePropertiesResourceRequests + """ + + _validation = { + 'provisioning_state': {'readonly': True}, + } + + _attribute_map = { + 'k_pack_version': {'key': 'kPackVersion', 'type': 'str'}, + 'provisioning_state': {'key': 'provisioningState', 'type': 'str'}, + 'resource_requests': {'key': 'resourceRequests', 'type': 'BuildServicePropertiesResourceRequests'}, + } + + def __init__( + self, + *, + k_pack_version: Optional[str] = None, + resource_requests: Optional["BuildServicePropertiesResourceRequests"] = None, + **kwargs + ): + """ + :keyword k_pack_version: The installed KPack version in this build service. + :paramtype k_pack_version: str + :keyword resource_requests: The runtime resource configuration of this build service. + :paramtype resource_requests: + ~azure.mgmt.appplatform.v2022_01_01_preview.models.BuildServicePropertiesResourceRequests + """ + super(BuildServiceProperties, self).__init__(**kwargs) + self.k_pack_version = k_pack_version + self.provisioning_state = None + self.resource_requests = resource_requests + + +class BuildServicePropertiesResourceRequests(msrest.serialization.Model): + """The runtime resource configuration of this build service. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar cpu: vCPU allocated to the entire build service node pool. + :vartype cpu: str + :ivar memory: Memory allocated to the entire build service node pool. + :vartype memory: str + """ + + _validation = { + 'cpu': {'readonly': True}, + 'memory': {'readonly': True}, + } + + _attribute_map = { + 'cpu': {'key': 'cpu', 'type': 'str'}, + 'memory': {'key': 'memory', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + """ + """ + super(BuildServicePropertiesResourceRequests, self).__init__(**kwargs) + self.cpu = None + self.memory = None + + +class BuildStageProperties(msrest.serialization.Model): + """The build stage (init-container and container) resources in build pod. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar name: The name of this build stage resource. + :vartype name: str + :ivar status: The provisioning state of this build stage resource. Possible values include: + "NotStarted", "Running", "Succeeded", "Failed". + :vartype status: str or + ~azure.mgmt.appplatform.v2022_01_01_preview.models.KPackBuildStageProvisioningState + """ + + _validation = { + 'name': {'readonly': True}, + 'status': {'readonly': True}, + } + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'status': {'key': 'status', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + """ + """ + super(BuildStageProperties, self).__init__(**kwargs) + self.name = None + self.status = 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 system_data: Metadata pertaining to creation and last modification of the resource. + :vartype system_data: ~azure.mgmt.appplatform.v2022_01_01_preview.models.SystemData + :ivar properties: Properties of the certificate resource payload. + :vartype properties: ~azure.mgmt.appplatform.v2022_01_01_preview.models.CertificateProperties + """ + + _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'}, + 'system_data': {'key': 'systemData', 'type': 'SystemData'}, + '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.v2022_01_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.v2022_01_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.v2022_01_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.v2022_01_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.v2022_01_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.v2022_01_01_preview.models.ProvisioningState + :ivar network_profile: Network profile of the Service. + :vartype network_profile: ~azure.mgmt.appplatform.v2022_01_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.v2022_01_01_preview.models.PowerState + :ivar zone_redundant: + :vartype zone_redundant: bool + :ivar fqdn: Fully qualified dns name of the service instance. + :vartype fqdn: str + """ + + _validation = { + 'provisioning_state': {'readonly': True}, + 'version': {'readonly': True}, + 'service_id': {'readonly': True}, + 'power_state': {'readonly': True}, + 'fqdn': {'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'}, + 'zone_redundant': {'key': 'zoneRedundant', 'type': 'bool'}, + 'fqdn': {'key': 'fqdn', 'type': 'str'}, + } + + def __init__( + self, + *, + network_profile: Optional["NetworkProfile"] = None, + zone_redundant: Optional[bool] = False, + **kwargs + ): + """ + :keyword network_profile: Network profile of the Service. + :paramtype network_profile: ~azure.mgmt.appplatform.v2022_01_01_preview.models.NetworkProfile + :keyword zone_redundant: + :paramtype zone_redundant: bool + """ + 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 + self.zone_redundant = zone_redundant + self.fqdn = 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.v2022_01_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.v2022_01_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.v2022_01_01_preview.models.ConfigServerState + :ivar error: Error when apply config server settings. + :vartype error: ~azure.mgmt.appplatform.v2022_01_01_preview.models.Error + :ivar config_server: Settings of config server. + :vartype config_server: ~azure.mgmt.appplatform.v2022_01_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.v2022_01_01_preview.models.Error + :keyword config_server: Settings of config server. + :paramtype config_server: + ~azure.mgmt.appplatform.v2022_01_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 system_data: Metadata pertaining to creation and last modification of the resource. + :vartype system_data: ~azure.mgmt.appplatform.v2022_01_01_preview.models.SystemData + :ivar properties: Properties of the Config Server resource. + :vartype properties: ~azure.mgmt.appplatform.v2022_01_01_preview.models.ConfigServerProperties + """ + + _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'}, + 'system_data': {'key': 'systemData', 'type': 'SystemData'}, + '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.v2022_01_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.v2022_01_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.v2022_01_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.v2022_01_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.v2022_01_01_preview.models.ConfigServerSettingsErrorRecord] + """ + super(ConfigServerSettingsValidateResult, self).__init__(**kwargs) + self.is_valid = is_valid + self.details = details + + +class ConfigurationServiceGitProperty(msrest.serialization.Model): + """Property of git environment. + + :ivar repositories: Repositories of Application Configuration Service git property. + :vartype repositories: + list[~azure.mgmt.appplatform.v2022_01_01_preview.models.ConfigurationServiceGitRepository] + """ + + _attribute_map = { + 'repositories': {'key': 'repositories', 'type': '[ConfigurationServiceGitRepository]'}, + } + + def __init__( + self, + *, + repositories: Optional[List["ConfigurationServiceGitRepository"]] = None, + **kwargs + ): + """ + :keyword repositories: Repositories of Application Configuration Service git property. + :paramtype repositories: + list[~azure.mgmt.appplatform.v2022_01_01_preview.models.ConfigurationServiceGitRepository] + """ + super(ConfigurationServiceGitProperty, self).__init__(**kwargs) + self.repositories = repositories + + +class ConfigurationServiceGitPropertyValidateResult(msrest.serialization.Model): + """Validation result for configuration service settings. + + :ivar is_valid: Indicate if the configuration service settings are valid. + :vartype is_valid: bool + :ivar git_repos_validation_result: The detail validation results. + :vartype git_repos_validation_result: + list[~azure.mgmt.appplatform.v2022_01_01_preview.models.ValidationMessages] + """ + + _attribute_map = { + 'is_valid': {'key': 'isValid', 'type': 'bool'}, + 'git_repos_validation_result': {'key': 'gitReposValidationResult', 'type': '[ValidationMessages]'}, + } + + def __init__( + self, + *, + is_valid: Optional[bool] = None, + git_repos_validation_result: Optional[List["ValidationMessages"]] = None, + **kwargs + ): + """ + :keyword is_valid: Indicate if the configuration service settings are valid. + :paramtype is_valid: bool + :keyword git_repos_validation_result: The detail validation results. + :paramtype git_repos_validation_result: + list[~azure.mgmt.appplatform.v2022_01_01_preview.models.ValidationMessages] + """ + super(ConfigurationServiceGitPropertyValidateResult, self).__init__(**kwargs) + self.is_valid = is_valid + self.git_repos_validation_result = git_repos_validation_result + + +class ConfigurationServiceGitRepository(msrest.serialization.Model): + """Git repository property payload for Application Configuration Service. + + All required parameters must be populated in order to send to Azure. + + :ivar name: Required. Name of the repository. + :vartype name: str + :ivar patterns: Required. Collection of patterns of the repository. + :vartype patterns: list[str] + :ivar uri: Required. URI of the repository. + :vartype uri: str + :ivar label: Required. 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}, + 'patterns': {'required': True}, + 'uri': {'required': True}, + 'label': {'required': True}, + } + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'patterns': {'key': 'patterns', '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, + patterns: List[str], + uri: str, + label: str, + 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 patterns: Required. Collection of patterns of the repository. + :paramtype patterns: list[str] + :keyword uri: Required. URI of the repository. + :paramtype uri: str + :keyword label: Required. 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(ConfigurationServiceGitRepository, self).__init__(**kwargs) + self.name = name + self.patterns = patterns + 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 ConfigurationServiceInstance(msrest.serialization.Model): + """Collection of instances belong to the Application Configuration Service. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar name: Name of the Application Configuration Service instance. + :vartype name: str + :ivar status: Status of the Application Configuration Service instance. + :vartype status: str + """ + + _validation = { + 'name': {'readonly': True}, + 'status': {'readonly': True}, + } + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'status': {'key': 'status', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + """ + """ + super(ConfigurationServiceInstance, self).__init__(**kwargs) + self.name = None + self.status = None + + +class ConfigurationServiceProperties(msrest.serialization.Model): + """Application Configuration Service properties payload. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar provisioning_state: State of the Application Configuration Service. Possible values + include: "Creating", "Updating", "Succeeded", "Failed", "Deleting". + :vartype provisioning_state: str or + ~azure.mgmt.appplatform.v2022_01_01_preview.models.ConfigurationServiceProvisioningState + :ivar resource_requests: The requested resource quantity for required CPU and Memory. + :vartype resource_requests: + ~azure.mgmt.appplatform.v2022_01_01_preview.models.ConfigurationServiceResourceRequests + :ivar instances: Collection of instances belong to Application Configuration Service. + :vartype instances: + list[~azure.mgmt.appplatform.v2022_01_01_preview.models.ConfigurationServiceInstance] + :ivar settings: The settings of Application Configuration Service. + :vartype settings: + ~azure.mgmt.appplatform.v2022_01_01_preview.models.ConfigurationServiceSettings + """ + + _validation = { + 'provisioning_state': {'readonly': True}, + 'resource_requests': {'readonly': True}, + 'instances': {'readonly': True}, + } + + _attribute_map = { + 'provisioning_state': {'key': 'provisioningState', 'type': 'str'}, + 'resource_requests': {'key': 'resourceRequests', 'type': 'ConfigurationServiceResourceRequests'}, + 'instances': {'key': 'instances', 'type': '[ConfigurationServiceInstance]'}, + 'settings': {'key': 'settings', 'type': 'ConfigurationServiceSettings'}, + } + + def __init__( + self, + *, + settings: Optional["ConfigurationServiceSettings"] = None, + **kwargs + ): + """ + :keyword settings: The settings of Application Configuration Service. + :paramtype settings: + ~azure.mgmt.appplatform.v2022_01_01_preview.models.ConfigurationServiceSettings + """ + super(ConfigurationServiceProperties, self).__init__(**kwargs) + self.provisioning_state = None + self.resource_requests = None + self.instances = None + self.settings = settings + + +class ConfigurationServiceResource(ProxyResource): + """Application Configuration 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 system_data: Metadata pertaining to creation and last modification of the resource. + :vartype system_data: ~azure.mgmt.appplatform.v2022_01_01_preview.models.SystemData + :ivar properties: Application Configuration Service properties payload. + :vartype properties: + ~azure.mgmt.appplatform.v2022_01_01_preview.models.ConfigurationServiceProperties + """ + + _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'}, + 'system_data': {'key': 'systemData', 'type': 'SystemData'}, + 'properties': {'key': 'properties', 'type': 'ConfigurationServiceProperties'}, + } + + def __init__( + self, + *, + properties: Optional["ConfigurationServiceProperties"] = None, + **kwargs + ): + """ + :keyword properties: Application Configuration Service properties payload. + :paramtype properties: + ~azure.mgmt.appplatform.v2022_01_01_preview.models.ConfigurationServiceProperties + """ + super(ConfigurationServiceResource, self).__init__(**kwargs) + self.properties = properties + + +class ConfigurationServiceResourceCollection(msrest.serialization.Model): + """Object that includes an array of configuration service resources and a possible link for next set. + + :ivar value: Collection of configuration service resources. + :vartype value: + list[~azure.mgmt.appplatform.v2022_01_01_preview.models.ConfigurationServiceResource] + :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': '[ConfigurationServiceResource]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + *, + value: Optional[List["ConfigurationServiceResource"]] = None, + next_link: Optional[str] = None, + **kwargs + ): + """ + :keyword value: Collection of configuration service resources. + :paramtype value: + list[~azure.mgmt.appplatform.v2022_01_01_preview.models.ConfigurationServiceResource] + :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(ConfigurationServiceResourceCollection, self).__init__(**kwargs) + self.value = value + self.next_link = next_link + + +class ConfigurationServiceResourceRequests(msrest.serialization.Model): + """Resource request payload of Application Configuration Service. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar cpu: Cpu allocated to each Application Configuration Service instance. + :vartype cpu: str + :ivar memory: Memory allocated to each Application Configuration Service instance. + :vartype memory: str + :ivar instance_count: Instance count of the Application Configuration Service. + :vartype instance_count: int + """ + + _validation = { + 'cpu': {'readonly': True}, + 'memory': {'readonly': True}, + 'instance_count': {'readonly': True}, + } + + _attribute_map = { + 'cpu': {'key': 'cpu', 'type': 'str'}, + 'memory': {'key': 'memory', 'type': 'str'}, + 'instance_count': {'key': 'instanceCount', 'type': 'int'}, + } + + def __init__( + self, + **kwargs + ): + """ + """ + super(ConfigurationServiceResourceRequests, self).__init__(**kwargs) + self.cpu = None + self.memory = None + self.instance_count = None + + +class ConfigurationServiceSettings(msrest.serialization.Model): + """The settings of Application Configuration Service. + + :ivar git_property: Property of git environment. + :vartype git_property: + ~azure.mgmt.appplatform.v2022_01_01_preview.models.ConfigurationServiceGitProperty + """ + + _attribute_map = { + 'git_property': {'key': 'gitProperty', 'type': 'ConfigurationServiceGitProperty'}, + } + + def __init__( + self, + *, + git_property: Optional["ConfigurationServiceGitProperty"] = None, + **kwargs + ): + """ + :keyword git_property: Property of git environment. + :paramtype git_property: + ~azure.mgmt.appplatform.v2022_01_01_preview.models.ConfigurationServiceGitProperty + """ + super(ConfigurationServiceSettings, self).__init__(**kwargs) + self.git_property = git_property + + +class ConfigurationServiceSettingsValidateResult(msrest.serialization.Model): + """Validation result for configuration service settings. + + :ivar git_property_validation_result: Validation result for configuration service settings. + :vartype git_property_validation_result: + ~azure.mgmt.appplatform.v2022_01_01_preview.models.ConfigurationServiceGitPropertyValidateResult + """ + + _attribute_map = { + 'git_property_validation_result': {'key': 'gitPropertyValidationResult', 'type': 'ConfigurationServiceGitPropertyValidateResult'}, + } + + def __init__( + self, + *, + git_property_validation_result: Optional["ConfigurationServiceGitPropertyValidateResult"] = None, + **kwargs + ): + """ + :keyword git_property_validation_result: Validation result for configuration service settings. + :paramtype git_property_validation_result: + ~azure.mgmt.appplatform.v2022_01_01_preview.models.ConfigurationServiceGitPropertyValidateResult + """ + super(ConfigurationServiceSettingsValidateResult, self).__init__(**kwargs) + self.git_property_validation_result = git_property_validation_result + + +class ContainerProbeSettings(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(ContainerProbeSettings, self).__init__(**kwargs) + self.disable_probe = disable_probe + + +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: 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}, + } + + _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: Optional[str] = None, + **kwargs + ): + """ + :keyword content: 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.v2022_01_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.v2022_01_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 CustomContainerUserSourceInfo(UserSourceInfo): + """Custom container user source info. + + All required parameters must be populated in order to send to Azure. + + :ivar type: Required. Type of the source uploaded.Constant filled by server. + :vartype type: str + :ivar version: Version of the source. + :vartype version: str + :ivar custom_container: Custom container payload. + :vartype custom_container: ~azure.mgmt.appplatform.v2022_01_01_preview.models.CustomContainer + """ + + _validation = { + 'type': {'required': True}, + } + + _attribute_map = { + 'type': {'key': 'type', 'type': 'str'}, + 'version': {'key': 'version', 'type': 'str'}, + 'custom_container': {'key': 'customContainer', 'type': 'CustomContainer'}, + } + + def __init__( + self, + *, + version: Optional[str] = None, + custom_container: Optional["CustomContainer"] = None, + **kwargs + ): + """ + :keyword version: Version of the source. + :paramtype version: str + :keyword custom_container: Custom container payload. + :paramtype custom_container: ~azure.mgmt.appplatform.v2022_01_01_preview.models.CustomContainer + """ + super(CustomContainerUserSourceInfo, self).__init__(version=version, **kwargs) + self.type = 'Container' # type: str + self.custom_container = custom_container + + +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 system_data: Metadata pertaining to creation and last modification of the resource. + :vartype system_data: ~azure.mgmt.appplatform.v2022_01_01_preview.models.SystemData + :ivar properties: Properties of the custom domain resource. + :vartype properties: ~azure.mgmt.appplatform.v2022_01_01_preview.models.CustomDomainProperties + """ + + _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'}, + 'system_data': {'key': 'systemData', 'type': 'SystemData'}, + '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.v2022_01_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.v2022_01_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.v2022_01_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.v2022_01_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.v2022_01_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 + :ivar zone: Availability zone information of the deployment instance. + :vartype zone: str + """ + + _validation = { + 'name': {'readonly': True}, + 'status': {'readonly': True}, + 'reason': {'readonly': True}, + 'discovery_status': {'readonly': True}, + 'start_time': {'readonly': True}, + 'zone': {'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'}, + 'zone': {'key': 'zone', '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 + self.zone = 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 system_data: Metadata pertaining to creation and last modification of the resource. + :vartype system_data: ~azure.mgmt.appplatform.v2022_01_01_preview.models.SystemData + :ivar properties: Properties of the Deployment resource. + :vartype properties: + ~azure.mgmt.appplatform.v2022_01_01_preview.models.DeploymentResourceProperties + :ivar sku: Sku of the Deployment resource. + :vartype sku: ~azure.mgmt.appplatform.v2022_01_01_preview.models.Sku + """ + + _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'}, + 'system_data': {'key': 'systemData', 'type': 'SystemData'}, + '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.v2022_01_01_preview.models.DeploymentResourceProperties + :keyword sku: Sku of the Deployment resource. + :paramtype sku: ~azure.mgmt.appplatform.v2022_01_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.v2022_01_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.v2022_01_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.v2022_01_01_preview.models.UserSourceInfo + :ivar deployment_settings: Deployment settings of the Deployment. + :vartype deployment_settings: + ~azure.mgmt.appplatform.v2022_01_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.v2022_01_01_preview.models.DeploymentResourceProvisioningState + :ivar status: Status of the Deployment. Possible values include: "Stopped", "Running". + :vartype status: str or + ~azure.mgmt.appplatform.v2022_01_01_preview.models.DeploymentResourceStatus + :ivar active: Indicates whether the Deployment is active. + :vartype active: bool + :ivar instances: Collection of instances belong to the Deployment. + :vartype instances: list[~azure.mgmt.appplatform.v2022_01_01_preview.models.DeploymentInstance] + """ + + _validation = { + 'provisioning_state': {'readonly': True}, + 'status': {'readonly': True}, + 'instances': {'readonly': True}, + } + + _attribute_map = { + 'source': {'key': 'source', 'type': 'UserSourceInfo'}, + 'deployment_settings': {'key': 'deploymentSettings', 'type': 'DeploymentSettings'}, + 'provisioning_state': {'key': 'provisioningState', 'type': 'str'}, + 'status': {'key': 'status', 'type': 'str'}, + 'active': {'key': 'active', 'type': 'bool'}, + 'instances': {'key': 'instances', 'type': '[DeploymentInstance]'}, + } + + def __init__( + self, + *, + source: Optional["UserSourceInfo"] = None, + deployment_settings: Optional["DeploymentSettings"] = None, + active: Optional[bool] = None, + **kwargs + ): + """ + :keyword source: Uploaded source information of the deployment. + :paramtype source: ~azure.mgmt.appplatform.v2022_01_01_preview.models.UserSourceInfo + :keyword deployment_settings: Deployment settings of the Deployment. + :paramtype deployment_settings: + ~azure.mgmt.appplatform.v2022_01_01_preview.models.DeploymentSettings + :keyword active: Indicates whether the Deployment is active. + :paramtype active: bool + """ + super(DeploymentResourceProperties, self).__init__(**kwargs) + self.source = source + self.deployment_settings = deployment_settings + self.provisioning_state = None + self.status = None + self.active = active + self.instances = None + + +class DeploymentSettings(msrest.serialization.Model): + """Deployment settings payload. + + :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.v2022_01_01_preview.models.ResourceRequests + :ivar environment_variables: Collection of environment variables. + :vartype environment_variables: dict[str, str] + :ivar addon_configs: Collection of addons. + :vartype addon_configs: dict[str, dict[str, any]] + :ivar container_probe_settings: Container liveness and readiness probe settings. + :vartype container_probe_settings: + ~azure.mgmt.appplatform.v2022_01_01_preview.models.ContainerProbeSettings + """ + + _attribute_map = { + 'resource_requests': {'key': 'resourceRequests', 'type': 'ResourceRequests'}, + 'environment_variables': {'key': 'environmentVariables', 'type': '{str}'}, + 'addon_configs': {'key': 'addonConfigs', 'type': '{{object}}'}, + 'container_probe_settings': {'key': 'containerProbeSettings', 'type': 'ContainerProbeSettings'}, + } + + def __init__( + self, + *, + resource_requests: Optional["ResourceRequests"] = None, + environment_variables: Optional[Dict[str, str]] = None, + addon_configs: Optional[Dict[str, Dict[str, Any]]] = None, + container_probe_settings: Optional["ContainerProbeSettings"] = None, + **kwargs + ): + """ + :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.v2022_01_01_preview.models.ResourceRequests + :keyword environment_variables: Collection of environment variables. + :paramtype environment_variables: dict[str, str] + :keyword addon_configs: Collection of addons. + :paramtype addon_configs: dict[str, dict[str, any]] + :keyword container_probe_settings: Container liveness and readiness probe settings. + :paramtype container_probe_settings: + ~azure.mgmt.appplatform.v2022_01_01_preview.models.ContainerProbeSettings + """ + super(DeploymentSettings, self).__init__(**kwargs) + self.resource_requests = resource_requests + self.environment_variables = environment_variables + self.addon_configs = addon_configs + self.container_probe_settings = container_probe_settings + + +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 GatewayApiMetadataProperties(msrest.serialization.Model): + """API metadata property for Spring Cloud Gateway. + + :ivar title: Title describing the context of the APIs available on the Gateway instance + (default: ``Spring Cloud Gateway for K8S``\ ). + :vartype title: str + :ivar description: Detailed description of the APIs available on the Gateway instance (default: + ``Generated OpenAPI 3 document that describes the API routes configured.``\ ). + :vartype description: str + :ivar documentation: Location of additional documentation for the APIs available on the Gateway + instance. + :vartype documentation: str + :ivar version: Version of APIs available on this Gateway instance (default: ``unspecified``\ ). + :vartype version: str + :ivar server_url: Base URL that API consumers will use to access APIs on the Gateway instance. + :vartype server_url: str + """ + + _attribute_map = { + 'title': {'key': 'title', 'type': 'str'}, + 'description': {'key': 'description', 'type': 'str'}, + 'documentation': {'key': 'documentation', 'type': 'str'}, + 'version': {'key': 'version', 'type': 'str'}, + 'server_url': {'key': 'serverUrl', 'type': 'str'}, + } + + def __init__( + self, + *, + title: Optional[str] = None, + description: Optional[str] = None, + documentation: Optional[str] = None, + version: Optional[str] = None, + server_url: Optional[str] = None, + **kwargs + ): + """ + :keyword title: Title describing the context of the APIs available on the Gateway instance + (default: ``Spring Cloud Gateway for K8S``\ ). + :paramtype title: str + :keyword description: Detailed description of the APIs available on the Gateway instance + (default: ``Generated OpenAPI 3 document that describes the API routes configured.``\ ). + :paramtype description: str + :keyword documentation: Location of additional documentation for the APIs available on the + Gateway instance. + :paramtype documentation: str + :keyword version: Version of APIs available on this Gateway instance (default: ``unspecified``\ + ). + :paramtype version: str + :keyword server_url: Base URL that API consumers will use to access APIs on the Gateway + instance. + :paramtype server_url: str + """ + super(GatewayApiMetadataProperties, self).__init__(**kwargs) + self.title = title + self.description = description + self.documentation = documentation + self.version = version + self.server_url = server_url + + +class GatewayApiRoute(msrest.serialization.Model): + """API route config of the Spring Cloud Gateway. + + :ivar title: A title, will be applied to methods in the generated OpenAPI documentation. + :vartype title: str + :ivar description: A description, will be applied to methods in the generated OpenAPI + documentation. + :vartype description: str + :ivar uri: Full uri, will override ``appName``. + :vartype uri: str + :ivar sso_enabled: Enable sso validation. + :vartype sso_enabled: bool + :ivar token_relay: Pass currently-authenticated user's identity token to application service, + default is 'false'. + :vartype token_relay: bool + :ivar predicates: A number of conditions to evaluate a route for each request. Each predicate + may be evaluated against request headers and parameter values. All of the predicates associated + with a route must evaluate to true for the route to be matched to the request. + :vartype predicates: list[str] + :ivar filters: To modify the request before sending it to the target endpoint, or the received + response. + :vartype filters: list[str] + :ivar order: Route processing order. + :vartype order: int + :ivar tags: A set of tags. Classification tags, will be applied to methods in the generated + OpenAPI documentation. + :vartype tags: list[str] + """ + + _attribute_map = { + 'title': {'key': 'title', 'type': 'str'}, + 'description': {'key': 'description', 'type': 'str'}, + 'uri': {'key': 'uri', 'type': 'str'}, + 'sso_enabled': {'key': 'ssoEnabled', 'type': 'bool'}, + 'token_relay': {'key': 'tokenRelay', 'type': 'bool'}, + 'predicates': {'key': 'predicates', 'type': '[str]'}, + 'filters': {'key': 'filters', 'type': '[str]'}, + 'order': {'key': 'order', 'type': 'int'}, + 'tags': {'key': 'tags', 'type': '[str]'}, + } + + def __init__( + self, + *, + title: Optional[str] = None, + description: Optional[str] = None, + uri: Optional[str] = None, + sso_enabled: Optional[bool] = None, + token_relay: Optional[bool] = None, + predicates: Optional[List[str]] = None, + filters: Optional[List[str]] = None, + order: Optional[int] = None, + tags: Optional[List[str]] = None, + **kwargs + ): + """ + :keyword title: A title, will be applied to methods in the generated OpenAPI documentation. + :paramtype title: str + :keyword description: A description, will be applied to methods in the generated OpenAPI + documentation. + :paramtype description: str + :keyword uri: Full uri, will override ``appName``. + :paramtype uri: str + :keyword sso_enabled: Enable sso validation. + :paramtype sso_enabled: bool + :keyword token_relay: Pass currently-authenticated user's identity token to application + service, default is 'false'. + :paramtype token_relay: bool + :keyword predicates: A number of conditions to evaluate a route for each request. Each + predicate may be evaluated against request headers and parameter values. All of the predicates + associated with a route must evaluate to true for the route to be matched to the request. + :paramtype predicates: list[str] + :keyword filters: To modify the request before sending it to the target endpoint, or the + received response. + :paramtype filters: list[str] + :keyword order: Route processing order. + :paramtype order: int + :keyword tags: A set of tags. Classification tags, will be applied to methods in the generated + OpenAPI documentation. + :paramtype tags: list[str] + """ + super(GatewayApiRoute, self).__init__(**kwargs) + self.title = title + self.description = description + self.uri = uri + self.sso_enabled = sso_enabled + self.token_relay = token_relay + self.predicates = predicates + self.filters = filters + self.order = order + self.tags = tags + + +class GatewayCorsProperties(msrest.serialization.Model): + """Cross-Origin Resource Sharing property. + + :ivar allowed_origins: Allowed origins to make cross-site requests. The special value ``*`` + allows all domains. + :vartype allowed_origins: list[str] + :ivar allowed_methods: Allowed HTTP methods on cross-site requests. The special value ``*`` + allows all methods. If not set, ``GET`` and ``HEAD`` are allowed by default. + :vartype allowed_methods: list[str] + :ivar allowed_headers: Allowed headers in cross-site requests. The special value ``*`` allows + actual requests to send any header. + :vartype allowed_headers: list[str] + :ivar max_age: How long, in seconds, the response from a pre-flight request can be cached by + clients. + :vartype max_age: int + :ivar allow_credentials: Whether user credentials are supported on cross-site requests. Valid + values: ``true``\ , ``false``. + :vartype allow_credentials: bool + :ivar exposed_headers: HTTP response headers to expose for cross-site requests. + :vartype exposed_headers: list[str] + """ + + _attribute_map = { + 'allowed_origins': {'key': 'allowedOrigins', 'type': '[str]'}, + 'allowed_methods': {'key': 'allowedMethods', 'type': '[str]'}, + 'allowed_headers': {'key': 'allowedHeaders', 'type': '[str]'}, + 'max_age': {'key': 'maxAge', 'type': 'int'}, + 'allow_credentials': {'key': 'allowCredentials', 'type': 'bool'}, + 'exposed_headers': {'key': 'exposedHeaders', 'type': '[str]'}, + } + + def __init__( + self, + *, + allowed_origins: Optional[List[str]] = None, + allowed_methods: Optional[List[str]] = None, + allowed_headers: Optional[List[str]] = None, + max_age: Optional[int] = None, + allow_credentials: Optional[bool] = None, + exposed_headers: Optional[List[str]] = None, + **kwargs + ): + """ + :keyword allowed_origins: Allowed origins to make cross-site requests. The special value ``*`` + allows all domains. + :paramtype allowed_origins: list[str] + :keyword allowed_methods: Allowed HTTP methods on cross-site requests. The special value ``*`` + allows all methods. If not set, ``GET`` and ``HEAD`` are allowed by default. + :paramtype allowed_methods: list[str] + :keyword allowed_headers: Allowed headers in cross-site requests. The special value ``*`` + allows actual requests to send any header. + :paramtype allowed_headers: list[str] + :keyword max_age: How long, in seconds, the response from a pre-flight request can be cached by + clients. + :paramtype max_age: int + :keyword allow_credentials: Whether user credentials are supported on cross-site requests. + Valid values: ``true``\ , ``false``. + :paramtype allow_credentials: bool + :keyword exposed_headers: HTTP response headers to expose for cross-site requests. + :paramtype exposed_headers: list[str] + """ + super(GatewayCorsProperties, self).__init__(**kwargs) + self.allowed_origins = allowed_origins + self.allowed_methods = allowed_methods + self.allowed_headers = allowed_headers + self.max_age = max_age + self.allow_credentials = allow_credentials + self.exposed_headers = exposed_headers + + +class GatewayCustomDomainProperties(msrest.serialization.Model): + """The properties of custom domain for Spring Cloud Gateway. + + :ivar thumbprint: The thumbprint of bound certificate. + :vartype thumbprint: str + """ + + _attribute_map = { + 'thumbprint': {'key': 'thumbprint', 'type': 'str'}, + } + + def __init__( + self, + *, + thumbprint: Optional[str] = None, + **kwargs + ): + """ + :keyword thumbprint: The thumbprint of bound certificate. + :paramtype thumbprint: str + """ + super(GatewayCustomDomainProperties, self).__init__(**kwargs) + self.thumbprint = thumbprint + + +class GatewayCustomDomainResource(ProxyResource): + """Custom domain of the Spring Cloud Gateway. + + 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 system_data: Metadata pertaining to creation and last modification of the resource. + :vartype system_data: ~azure.mgmt.appplatform.v2022_01_01_preview.models.SystemData + :ivar properties: The properties of custom domain for Spring Cloud Gateway. + :vartype properties: + ~azure.mgmt.appplatform.v2022_01_01_preview.models.GatewayCustomDomainProperties + """ + + _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'}, + 'system_data': {'key': 'systemData', 'type': 'SystemData'}, + 'properties': {'key': 'properties', 'type': 'GatewayCustomDomainProperties'}, + } + + def __init__( + self, + *, + properties: Optional["GatewayCustomDomainProperties"] = None, + **kwargs + ): + """ + :keyword properties: The properties of custom domain for Spring Cloud Gateway. + :paramtype properties: + ~azure.mgmt.appplatform.v2022_01_01_preview.models.GatewayCustomDomainProperties + """ + super(GatewayCustomDomainResource, self).__init__(**kwargs) + self.properties = properties + + +class GatewayCustomDomainResourceCollection(msrest.serialization.Model): + """Object that includes an array of Spring Cloud Gateway custom domain resources and a possible link for next set. + + :ivar value: Collection of Spring Cloud Gateway custom domain resources. + :vartype value: + list[~azure.mgmt.appplatform.v2022_01_01_preview.models.GatewayCustomDomainResource] + :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': '[GatewayCustomDomainResource]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + *, + value: Optional[List["GatewayCustomDomainResource"]] = None, + next_link: Optional[str] = None, + **kwargs + ): + """ + :keyword value: Collection of Spring Cloud Gateway custom domain resources. + :paramtype value: + list[~azure.mgmt.appplatform.v2022_01_01_preview.models.GatewayCustomDomainResource] + :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(GatewayCustomDomainResourceCollection, self).__init__(**kwargs) + self.value = value + self.next_link = next_link + + +class GatewayInstance(msrest.serialization.Model): + """Collection of instances belong to the Spring Cloud Gateway. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar name: Name of the Spring Cloud Gateway instance. + :vartype name: str + :ivar status: Status of the Spring Cloud Gateway instance. + :vartype status: str + """ + + _validation = { + 'name': {'readonly': True}, + 'status': {'readonly': True}, + } + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'status': {'key': 'status', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + """ + """ + super(GatewayInstance, self).__init__(**kwargs) + self.name = None + self.status = None + + +class GatewayOperatorProperties(msrest.serialization.Model): + """Properties of the Spring Cloud Gateway Operator. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar resource_requests: The requested resource quantity for required CPU and Memory. + :vartype resource_requests: + ~azure.mgmt.appplatform.v2022_01_01_preview.models.GatewayOperatorResourceRequests + :ivar instances: Collection of instances belong to Spring Cloud Gateway operator. + :vartype instances: list[~azure.mgmt.appplatform.v2022_01_01_preview.models.GatewayInstance] + """ + + _validation = { + 'resource_requests': {'readonly': True}, + 'instances': {'readonly': True}, + } + + _attribute_map = { + 'resource_requests': {'key': 'resourceRequests', 'type': 'GatewayOperatorResourceRequests'}, + 'instances': {'key': 'instances', 'type': '[GatewayInstance]'}, + } + + def __init__( + self, + **kwargs + ): + """ + """ + super(GatewayOperatorProperties, self).__init__(**kwargs) + self.resource_requests = None + self.instances = None + + +class GatewayOperatorResourceRequests(msrest.serialization.Model): + """Properties of the Spring Cloud Gateway Operator. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar cpu: Cpu allocated to each Spring Cloud Gateway Operator instance. + :vartype cpu: str + :ivar memory: Memory allocated to each Spring Cloud Gateway Operator instance. + :vartype memory: str + :ivar instance_count: Instance count of the Spring Cloud Gateway Operator. + :vartype instance_count: int + """ + + _validation = { + 'cpu': {'readonly': True}, + 'memory': {'readonly': True}, + 'instance_count': {'readonly': True}, + } + + _attribute_map = { + 'cpu': {'key': 'cpu', 'type': 'str'}, + 'memory': {'key': 'memory', 'type': 'str'}, + 'instance_count': {'key': 'instanceCount', 'type': 'int'}, + } + + def __init__( + self, + **kwargs + ): + """ + """ + super(GatewayOperatorResourceRequests, self).__init__(**kwargs) + self.cpu = None + self.memory = None + self.instance_count = None + + +class GatewayProperties(msrest.serialization.Model): + """Spring Cloud Gateway properties payload. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar provisioning_state: State of the Spring Cloud Gateway. Possible values include: + "Creating", "Updating", "Succeeded", "Failed", "Deleting". + :vartype provisioning_state: str or + ~azure.mgmt.appplatform.v2022_01_01_preview.models.GatewayProvisioningState + :ivar public: Indicates whether the Spring Cloud Gateway exposes endpoint. + :vartype public: bool + :ivar url: URL of the Spring Cloud Gateway, exposed when 'public' is true. + :vartype url: str + :ivar https_only: Indicate if only https is allowed. + :vartype https_only: bool + :ivar sso_properties: Single sign-on related configuration. + :vartype sso_properties: ~azure.mgmt.appplatform.v2022_01_01_preview.models.SsoProperties + :ivar api_metadata_properties: API metadata property for Spring Cloud Gateway. + :vartype api_metadata_properties: + ~azure.mgmt.appplatform.v2022_01_01_preview.models.GatewayApiMetadataProperties + :ivar cors_properties: Cross-Origin Resource Sharing property. + :vartype cors_properties: + ~azure.mgmt.appplatform.v2022_01_01_preview.models.GatewayCorsProperties + :ivar resource_requests: The requested resource quantity for required CPU and Memory. + :vartype resource_requests: + ~azure.mgmt.appplatform.v2022_01_01_preview.models.GatewayResourceRequests + :ivar instances: Collection of instances belong to Spring Cloud Gateway. + :vartype instances: list[~azure.mgmt.appplatform.v2022_01_01_preview.models.GatewayInstance] + :ivar operator_properties: Properties of the Spring Cloud Gateway Operator. + :vartype operator_properties: + ~azure.mgmt.appplatform.v2022_01_01_preview.models.GatewayOperatorProperties + """ + + _validation = { + 'provisioning_state': {'readonly': True}, + 'url': {'readonly': True}, + 'instances': {'readonly': True}, + 'operator_properties': {'readonly': True}, + } + + _attribute_map = { + 'provisioning_state': {'key': 'provisioningState', 'type': 'str'}, + 'public': {'key': 'public', 'type': 'bool'}, + 'url': {'key': 'url', 'type': 'str'}, + 'https_only': {'key': 'httpsOnly', 'type': 'bool'}, + 'sso_properties': {'key': 'ssoProperties', 'type': 'SsoProperties'}, + 'api_metadata_properties': {'key': 'apiMetadataProperties', 'type': 'GatewayApiMetadataProperties'}, + 'cors_properties': {'key': 'corsProperties', 'type': 'GatewayCorsProperties'}, + 'resource_requests': {'key': 'resourceRequests', 'type': 'GatewayResourceRequests'}, + 'instances': {'key': 'instances', 'type': '[GatewayInstance]'}, + 'operator_properties': {'key': 'operatorProperties', 'type': 'GatewayOperatorProperties'}, + } + + def __init__( + self, + *, + public: Optional[bool] = None, + https_only: Optional[bool] = None, + sso_properties: Optional["SsoProperties"] = None, + api_metadata_properties: Optional["GatewayApiMetadataProperties"] = None, + cors_properties: Optional["GatewayCorsProperties"] = None, + resource_requests: Optional["GatewayResourceRequests"] = None, + **kwargs + ): + """ + :keyword public: Indicates whether the Spring Cloud Gateway exposes endpoint. + :paramtype public: bool + :keyword https_only: Indicate if only https is allowed. + :paramtype https_only: bool + :keyword sso_properties: Single sign-on related configuration. + :paramtype sso_properties: ~azure.mgmt.appplatform.v2022_01_01_preview.models.SsoProperties + :keyword api_metadata_properties: API metadata property for Spring Cloud Gateway. + :paramtype api_metadata_properties: + ~azure.mgmt.appplatform.v2022_01_01_preview.models.GatewayApiMetadataProperties + :keyword cors_properties: Cross-Origin Resource Sharing property. + :paramtype cors_properties: + ~azure.mgmt.appplatform.v2022_01_01_preview.models.GatewayCorsProperties + :keyword resource_requests: The requested resource quantity for required CPU and Memory. + :paramtype resource_requests: + ~azure.mgmt.appplatform.v2022_01_01_preview.models.GatewayResourceRequests + """ + super(GatewayProperties, self).__init__(**kwargs) + self.provisioning_state = None + self.public = public + self.url = None + self.https_only = https_only + self.sso_properties = sso_properties + self.api_metadata_properties = api_metadata_properties + self.cors_properties = cors_properties + self.resource_requests = resource_requests + self.instances = None + self.operator_properties = None + + +class GatewayResource(ProxyResource): + """Spring Cloud Gateway 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 system_data: Metadata pertaining to creation and last modification of the resource. + :vartype system_data: ~azure.mgmt.appplatform.v2022_01_01_preview.models.SystemData + :ivar properties: Spring Cloud Gateway properties payload. + :vartype properties: ~azure.mgmt.appplatform.v2022_01_01_preview.models.GatewayProperties + :ivar sku: Sku of the Spring Cloud Gateway resource. + :vartype sku: ~azure.mgmt.appplatform.v2022_01_01_preview.models.Sku + """ + + _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'}, + 'system_data': {'key': 'systemData', 'type': 'SystemData'}, + 'properties': {'key': 'properties', 'type': 'GatewayProperties'}, + 'sku': {'key': 'sku', 'type': 'Sku'}, + } + + def __init__( + self, + *, + properties: Optional["GatewayProperties"] = None, + sku: Optional["Sku"] = None, + **kwargs + ): + """ + :keyword properties: Spring Cloud Gateway properties payload. + :paramtype properties: ~azure.mgmt.appplatform.v2022_01_01_preview.models.GatewayProperties + :keyword sku: Sku of the Spring Cloud Gateway resource. + :paramtype sku: ~azure.mgmt.appplatform.v2022_01_01_preview.models.Sku + """ + super(GatewayResource, self).__init__(**kwargs) + self.properties = properties + self.sku = sku + + +class GatewayResourceCollection(msrest.serialization.Model): + """Object that includes an array of gateway resources and a possible link for next set. + + :ivar value: Collection of gateway resources. + :vartype value: list[~azure.mgmt.appplatform.v2022_01_01_preview.models.GatewayResource] + :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': '[GatewayResource]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + *, + value: Optional[List["GatewayResource"]] = None, + next_link: Optional[str] = None, + **kwargs + ): + """ + :keyword value: Collection of gateway resources. + :paramtype value: list[~azure.mgmt.appplatform.v2022_01_01_preview.models.GatewayResource] + :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(GatewayResourceCollection, self).__init__(**kwargs) + self.value = value + self.next_link = next_link + + +class GatewayResourceRequests(msrest.serialization.Model): + """Resource request payload of Spring Cloud Gateway. + + :ivar cpu: Cpu allocated to each Spring Cloud Gateway instance. + :vartype cpu: str + :ivar memory: Memory allocated to each Spring Cloud Gateway instance. + :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: Cpu allocated to each Spring Cloud Gateway instance. + :paramtype cpu: str + :keyword memory: Memory allocated to each Spring Cloud Gateway instance. + :paramtype memory: str + """ + super(GatewayResourceRequests, self).__init__(**kwargs) + self.cpu = cpu + self.memory = memory + + +class GatewayRouteConfigProperties(msrest.serialization.Model): + """API route config of the Spring Cloud Gateway. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar provisioning_state: State of the Spring Cloud Gateway route config. Possible values + include: "Creating", "Updating", "Succeeded", "Failed", "Deleting". + :vartype provisioning_state: str or + ~azure.mgmt.appplatform.v2022_01_01_preview.models.GatewayProvisioningState + :ivar app_resource_id: The resource Id of the Azure Spring Cloud app, required unless route + defines ``uri``. + :vartype app_resource_id: str + :ivar routes: Array of API routes, each route contains properties such as ``title``\ , ``uri``\ + , ``ssoEnabled``\ , ``predicates``\ , ``filters``. + :vartype routes: list[~azure.mgmt.appplatform.v2022_01_01_preview.models.GatewayApiRoute] + """ + + _validation = { + 'provisioning_state': {'readonly': True}, + } + + _attribute_map = { + 'provisioning_state': {'key': 'provisioningState', 'type': 'str'}, + 'app_resource_id': {'key': 'appResourceId', 'type': 'str'}, + 'routes': {'key': 'routes', 'type': '[GatewayApiRoute]'}, + } + + def __init__( + self, + *, + app_resource_id: Optional[str] = None, + routes: Optional[List["GatewayApiRoute"]] = None, + **kwargs + ): + """ + :keyword app_resource_id: The resource Id of the Azure Spring Cloud app, required unless route + defines ``uri``. + :paramtype app_resource_id: str + :keyword routes: Array of API routes, each route contains properties such as ``title``\ , + ``uri``\ , ``ssoEnabled``\ , ``predicates``\ , ``filters``. + :paramtype routes: list[~azure.mgmt.appplatform.v2022_01_01_preview.models.GatewayApiRoute] + """ + super(GatewayRouteConfigProperties, self).__init__(**kwargs) + self.provisioning_state = None + self.app_resource_id = app_resource_id + self.routes = routes + + +class GatewayRouteConfigResource(ProxyResource): + """Spring Cloud Gateway route config 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 system_data: Metadata pertaining to creation and last modification of the resource. + :vartype system_data: ~azure.mgmt.appplatform.v2022_01_01_preview.models.SystemData + :ivar properties: API route config of the Spring Cloud Gateway. + :vartype properties: + ~azure.mgmt.appplatform.v2022_01_01_preview.models.GatewayRouteConfigProperties + """ + + _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'}, + 'system_data': {'key': 'systemData', 'type': 'SystemData'}, + 'properties': {'key': 'properties', 'type': 'GatewayRouteConfigProperties'}, + } + + def __init__( + self, + *, + properties: Optional["GatewayRouteConfigProperties"] = None, + **kwargs + ): + """ + :keyword properties: API route config of the Spring Cloud Gateway. + :paramtype properties: + ~azure.mgmt.appplatform.v2022_01_01_preview.models.GatewayRouteConfigProperties + """ + super(GatewayRouteConfigResource, self).__init__(**kwargs) + self.properties = properties + + +class GatewayRouteConfigResourceCollection(msrest.serialization.Model): + """Object that includes an array of Spring Cloud Gateway route config resources and a possible link for next set. + + :ivar value: Collection of Spring Cloud Gateway route config resources. + :vartype value: + list[~azure.mgmt.appplatform.v2022_01_01_preview.models.GatewayRouteConfigResource] + :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': '[GatewayRouteConfigResource]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + *, + value: Optional[List["GatewayRouteConfigResource"]] = None, + next_link: Optional[str] = None, + **kwargs + ): + """ + :keyword value: Collection of Spring Cloud Gateway route config resources. + :paramtype value: + list[~azure.mgmt.appplatform.v2022_01_01_preview.models.GatewayRouteConfigResource] + :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(GatewayRouteConfigResourceCollection, self).__init__(**kwargs) + self.value = value + self.next_link = next_link + + +class GitPatternRepository(msrest.serialization.Model): + """Git repository property payload for config server. + + 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 UploadedUserSourceInfo(UserSourceInfo): + """Source with uploaded location. + + You probably want to use the sub-classes and not this class directly. Known + sub-classes are: JarUploadedUserSourceInfo, NetCoreZipUploadedUserSourceInfo, SourceUploadedUserSourceInfo. + + All required parameters must be populated in order to send to Azure. + + :ivar type: Required. Type of the source uploaded.Constant filled by server. + :vartype type: str + :ivar version: Version of the source. + :vartype version: str + :ivar relative_path: Relative path of the storage which stores the source. + :vartype relative_path: str + """ + + _validation = { + 'type': {'required': True}, + } + + _attribute_map = { + 'type': {'key': 'type', 'type': 'str'}, + 'version': {'key': 'version', 'type': 'str'}, + 'relative_path': {'key': 'relativePath', 'type': 'str'}, + } + + _subtype_map = { + 'type': {'Jar': 'JarUploadedUserSourceInfo', 'NetCoreZip': 'NetCoreZipUploadedUserSourceInfo', 'Source': 'SourceUploadedUserSourceInfo'} + } + + def __init__( + self, + *, + version: Optional[str] = None, + relative_path: Optional[str] = None, + **kwargs + ): + """ + :keyword version: Version of the source. + :paramtype version: str + :keyword relative_path: Relative path of the storage which stores the source. + :paramtype relative_path: str + """ + super(UploadedUserSourceInfo, self).__init__(version=version, **kwargs) + self.type = 'UploadedUserSourceInfo' # type: str + self.relative_path = relative_path + + +class JarUploadedUserSourceInfo(UploadedUserSourceInfo): + """Uploaded Jar binary for a deployment. + + All required parameters must be populated in order to send to Azure. + + :ivar type: Required. Type of the source uploaded.Constant filled by server. + :vartype type: str + :ivar version: Version of the source. + :vartype version: str + :ivar relative_path: Relative path of the storage which stores the source. + :vartype relative_path: str + :ivar runtime_version: Runtime version of the Jar file. + :vartype runtime_version: str + :ivar jvm_options: JVM parameter. + :vartype jvm_options: str + """ + + _validation = { + 'type': {'required': True}, + } + + _attribute_map = { + 'type': {'key': 'type', 'type': 'str'}, + 'version': {'key': 'version', 'type': 'str'}, + 'relative_path': {'key': 'relativePath', 'type': 'str'}, + 'runtime_version': {'key': 'runtimeVersion', 'type': 'str'}, + 'jvm_options': {'key': 'jvmOptions', 'type': 'str'}, + } + + def __init__( + self, + *, + version: Optional[str] = None, + relative_path: Optional[str] = None, + runtime_version: Optional[str] = None, + jvm_options: Optional[str] = None, + **kwargs + ): + """ + :keyword version: Version of the source. + :paramtype version: str + :keyword relative_path: Relative path of the storage which stores the source. + :paramtype relative_path: str + :keyword runtime_version: Runtime version of the Jar file. + :paramtype runtime_version: str + :keyword jvm_options: JVM parameter. + :paramtype jvm_options: str + """ + super(JarUploadedUserSourceInfo, self).__init__(version=version, relative_path=relative_path, **kwargs) + self.type = 'Jar' # type: str + self.runtime_version = runtime_version + self.jvm_options = jvm_options + + +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.v2022_01_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.v2022_01_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.v2022_01_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.v2022_01_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.v2022_01_01_preview.models.MonitoringSettingState + :ivar error: Error when apply Monitoring Setting changes. + :vartype error: ~azure.mgmt.appplatform.v2022_01_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.v2022_01_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.v2022_01_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.v2022_01_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 system_data: Metadata pertaining to creation and last modification of the resource. + :vartype system_data: ~azure.mgmt.appplatform.v2022_01_01_preview.models.SystemData + :ivar properties: Properties of the Monitoring Setting resource. + :vartype properties: + ~azure.mgmt.appplatform.v2022_01_01_preview.models.MonitoringSettingProperties + """ + + _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'}, + 'system_data': {'key': 'systemData', 'type': 'SystemData'}, + '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.v2022_01_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 NetCoreZipUploadedUserSourceInfo(UploadedUserSourceInfo): + """Uploaded Jar binary for a deployment. + + All required parameters must be populated in order to send to Azure. + + :ivar type: Required. Type of the source uploaded.Constant filled by server. + :vartype type: str + :ivar version: Version of the source. + :vartype version: str + :ivar relative_path: Relative path of the storage which stores the source. + :vartype relative_path: 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 runtime_version: Runtime version of the .Net file. + :vartype runtime_version: str + """ + + _validation = { + 'type': {'required': True}, + } + + _attribute_map = { + 'type': {'key': 'type', 'type': 'str'}, + 'version': {'key': 'version', 'type': 'str'}, + 'relative_path': {'key': 'relativePath', 'type': 'str'}, + 'net_core_main_entry_path': {'key': 'netCoreMainEntryPath', 'type': 'str'}, + 'runtime_version': {'key': 'runtimeVersion', 'type': 'str'}, + } + + def __init__( + self, + *, + version: Optional[str] = None, + relative_path: Optional[str] = None, + net_core_main_entry_path: Optional[str] = None, + runtime_version: Optional[str] = None, + **kwargs + ): + """ + :keyword version: Version of the source. + :paramtype version: str + :keyword relative_path: Relative path of the storage which stores the source. + :paramtype relative_path: 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 runtime_version: Runtime version of the .Net file. + :paramtype runtime_version: str + """ + super(NetCoreZipUploadedUserSourceInfo, self).__init__(version=version, relative_path=relative_path, **kwargs) + self.type = 'NetCoreZip' # type: str + self.net_core_main_entry_path = net_core_main_entry_path + self.runtime_version = runtime_version + + +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.v2022_01_01_preview.models.NetworkProfileOutboundIPs + :ivar required_traffics: Required inbound or outbound traffics for Azure Spring Cloud instance. + :vartype required_traffics: + list[~azure.mgmt.appplatform.v2022_01_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.v2022_01_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.v2022_01_01_preview.models.ActionType + :ivar origin: Origin of the operation. + :vartype origin: str + :ivar properties: Properties of the operation. + :vartype properties: ~azure.mgmt.appplatform.v2022_01_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.v2022_01_01_preview.models.OperationDisplay + :keyword origin: Origin of the operation. + :paramtype origin: str + :keyword properties: Properties of the operation. + :paramtype properties: ~azure.mgmt.appplatform.v2022_01_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.v2022_01_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.v2022_01_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.v2022_01_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.v2022_01_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.v2022_01_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.v2022_01_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.v2022_01_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.v2022_01_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.v2022_01_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.v2022_01_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.v2022_01_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.v2022_01_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.v2022_01_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.v2022_01_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.v2022_01_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.v2022_01_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.v2022_01_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.v2022_01_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.v2022_01_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.v2022_01_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.v2022_01_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.v2022_01_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.v2022_01_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 ServiceRegistryInstance(msrest.serialization.Model): + """Collection of instances belong to the Service Registry. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar name: Name of the Service Registry instance. + :vartype name: str + :ivar status: Status of the Service Registry instance. + :vartype status: str + """ + + _validation = { + 'name': {'readonly': True}, + 'status': {'readonly': True}, + } + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'status': {'key': 'status', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + """ + """ + super(ServiceRegistryInstance, self).__init__(**kwargs) + self.name = None + self.status = None + + +class ServiceRegistryProperties(msrest.serialization.Model): + """Service Registry properties payload. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar provisioning_state: State of the Service Registry. Possible values include: "Creating", + "Updating", "Succeeded", "Failed", "Deleting". + :vartype provisioning_state: str or + ~azure.mgmt.appplatform.v2022_01_01_preview.models.ServiceRegistryProvisioningState + :ivar resource_requests: The requested resource quantity for required CPU and Memory. + :vartype resource_requests: + ~azure.mgmt.appplatform.v2022_01_01_preview.models.ServiceRegistryResourceRequests + :ivar instances: Collection of instances belong to Service Registry. + :vartype instances: + list[~azure.mgmt.appplatform.v2022_01_01_preview.models.ServiceRegistryInstance] + """ + + _validation = { + 'provisioning_state': {'readonly': True}, + 'resource_requests': {'readonly': True}, + 'instances': {'readonly': True}, + } + + _attribute_map = { + 'provisioning_state': {'key': 'provisioningState', 'type': 'str'}, + 'resource_requests': {'key': 'resourceRequests', 'type': 'ServiceRegistryResourceRequests'}, + 'instances': {'key': 'instances', 'type': '[ServiceRegistryInstance]'}, + } + + def __init__( + self, + **kwargs + ): + """ + """ + super(ServiceRegistryProperties, self).__init__(**kwargs) + self.provisioning_state = None + self.resource_requests = None + self.instances = None + + +class ServiceRegistryResource(ProxyResource): + """Service Registry 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 system_data: Metadata pertaining to creation and last modification of the resource. + :vartype system_data: ~azure.mgmt.appplatform.v2022_01_01_preview.models.SystemData + :ivar properties: Service Registry properties payload. + :vartype properties: + ~azure.mgmt.appplatform.v2022_01_01_preview.models.ServiceRegistryProperties + """ + + _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'}, + 'system_data': {'key': 'systemData', 'type': 'SystemData'}, + 'properties': {'key': 'properties', 'type': 'ServiceRegistryProperties'}, + } + + def __init__( + self, + *, + properties: Optional["ServiceRegistryProperties"] = None, + **kwargs + ): + """ + :keyword properties: Service Registry properties payload. + :paramtype properties: + ~azure.mgmt.appplatform.v2022_01_01_preview.models.ServiceRegistryProperties + """ + super(ServiceRegistryResource, self).__init__(**kwargs) + self.properties = properties + + +class ServiceRegistryResourceCollection(msrest.serialization.Model): + """Object that includes an array of Service Registry resources and a possible link for next set. + + :ivar value: Collection of Service Registry resources. + :vartype value: + list[~azure.mgmt.appplatform.v2022_01_01_preview.models.ServiceRegistryResource] + :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': '[ServiceRegistryResource]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + *, + value: Optional[List["ServiceRegistryResource"]] = None, + next_link: Optional[str] = None, + **kwargs + ): + """ + :keyword value: Collection of Service Registry resources. + :paramtype value: + list[~azure.mgmt.appplatform.v2022_01_01_preview.models.ServiceRegistryResource] + :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(ServiceRegistryResourceCollection, self).__init__(**kwargs) + self.value = value + self.next_link = next_link + + +class ServiceRegistryResourceRequests(msrest.serialization.Model): + """Resource request payload of Service Registry. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar cpu: Cpu allocated to each Service Registry instance. + :vartype cpu: str + :ivar memory: Memory allocated to each Service Registry instance. + :vartype memory: str + :ivar instance_count: Instance count of the Service Registry. + :vartype instance_count: int + """ + + _validation = { + 'cpu': {'readonly': True}, + 'memory': {'readonly': True}, + 'instance_count': {'readonly': True}, + } + + _attribute_map = { + 'cpu': {'key': 'cpu', 'type': 'str'}, + 'memory': {'key': 'memory', 'type': 'str'}, + 'instance_count': {'key': 'instanceCount', 'type': 'int'}, + } + + def __init__( + self, + **kwargs + ): + """ + """ + super(ServiceRegistryResourceRequests, self).__init__(**kwargs) + self.cpu = None + self.memory = None + self.instance_count = 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 system_data: Metadata pertaining to creation and last modification of the resource. + :vartype system_data: ~azure.mgmt.appplatform.v2022_01_01_preview.models.SystemData + :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}, + 'system_data': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'system_data': {'key': 'systemData', 'type': 'SystemData'}, + '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 system_data: Metadata pertaining to creation and last modification of the resource. + :vartype system_data: ~azure.mgmt.appplatform.v2022_01_01_preview.models.SystemData + :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.v2022_01_01_preview.models.ClusterResourceProperties + :ivar sku: Sku of the Service resource. + :vartype sku: ~azure.mgmt.appplatform.v2022_01_01_preview.models.Sku + """ + + _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'}, + 'system_data': {'key': 'systemData', 'type': 'SystemData'}, + '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.v2022_01_01_preview.models.ClusterResourceProperties + :keyword sku: Sku of the Service resource. + :paramtype sku: ~azure.mgmt.appplatform.v2022_01_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.v2022_01_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.v2022_01_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.v2022_01_01_preview.models.LogSpecification] + :ivar metric_specifications: Specifications of the Metrics for Azure Monitoring. + :vartype metric_specifications: + list[~azure.mgmt.appplatform.v2022_01_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.v2022_01_01_preview.models.LogSpecification] + :keyword metric_specifications: Specifications of the Metrics for Azure Monitoring. + :paramtype metric_specifications: + list[~azure.mgmt.appplatform.v2022_01_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.v2022_01_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.v2022_01_01_preview.models.SkuScaleType + """ + super(SkuCapacity, self).__init__(**kwargs) + self.minimum = minimum + self.maximum = maximum + self.default = default + self.scale_type = scale_type + + +class SourceUploadedUserSourceInfo(UploadedUserSourceInfo): + """Uploaded Java source code binary for a deployment. + + All required parameters must be populated in order to send to Azure. + + :ivar type: Required. Type of the source uploaded.Constant filled by server. + :vartype type: str + :ivar version: Version of the source. + :vartype version: str + :ivar relative_path: Relative path of the storage which stores the source. + :vartype relative_path: 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 runtime_version: Runtime version of the source file. + :vartype runtime_version: str + """ + + _validation = { + 'type': {'required': True}, + } + + _attribute_map = { + 'type': {'key': 'type', 'type': 'str'}, + 'version': {'key': 'version', 'type': 'str'}, + 'relative_path': {'key': 'relativePath', 'type': 'str'}, + 'artifact_selector': {'key': 'artifactSelector', 'type': 'str'}, + 'runtime_version': {'key': 'runtimeVersion', 'type': 'str'}, + } + + def __init__( + self, + *, + version: Optional[str] = None, + relative_path: Optional[str] = None, + artifact_selector: Optional[str] = None, + runtime_version: Optional[str] = None, + **kwargs + ): + """ + :keyword version: Version of the source. + :paramtype version: str + :keyword relative_path: Relative path of the storage which stores the source. + :paramtype relative_path: 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 runtime_version: Runtime version of the source file. + :paramtype runtime_version: str + """ + super(SourceUploadedUserSourceInfo, self).__init__(version=version, relative_path=relative_path, **kwargs) + self.type = 'Source' # type: str + self.artifact_selector = artifact_selector + self.runtime_version = runtime_version + + +class SsoProperties(msrest.serialization.Model): + """Single sign-on related configuration. + + :ivar scope: It defines the specific actions applications can be allowed to do on a user's + behalf. + :vartype scope: list[str] + :ivar client_id: The public identifier for the application. + :vartype client_id: str + :ivar client_secret: The secret known only to the application and the authorization server. + :vartype client_secret: str + :ivar issuer_uri: The URI of Issuer Identifier. + :vartype issuer_uri: str + """ + + _attribute_map = { + 'scope': {'key': 'scope', 'type': '[str]'}, + 'client_id': {'key': 'clientId', 'type': 'str'}, + 'client_secret': {'key': 'clientSecret', 'type': 'str'}, + 'issuer_uri': {'key': 'issuerUri', 'type': 'str'}, + } + + def __init__( + self, + *, + scope: Optional[List[str]] = None, + client_id: Optional[str] = None, + client_secret: Optional[str] = None, + issuer_uri: Optional[str] = None, + **kwargs + ): + """ + :keyword scope: It defines the specific actions applications can be allowed to do on a user's + behalf. + :paramtype scope: list[str] + :keyword client_id: The public identifier for the application. + :paramtype client_id: str + :keyword client_secret: The secret known only to the application and the authorization server. + :paramtype client_secret: str + :keyword issuer_uri: The URI of Issuer Identifier. + :paramtype issuer_uri: str + """ + super(SsoProperties, self).__init__(**kwargs) + self.scope = scope + self.client_id = client_id + self.client_secret = client_secret + self.issuer_uri = issuer_uri + + +class StackProperties(msrest.serialization.Model): + """KPack ClusterStack properties payload. + + :ivar id: Id of the ClusterStack. + :vartype id: str + :ivar version: Version of the ClusterStack. + :vartype version: str + """ + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'version': {'key': 'version', 'type': 'str'}, + } + + def __init__( + self, + *, + id: Optional[str] = None, + version: Optional[str] = None, + **kwargs + ): + """ + :keyword id: Id of the ClusterStack. + :paramtype id: str + :keyword version: Version of the ClusterStack. + :paramtype version: str + """ + super(StackProperties, self).__init__(**kwargs) + self.id = id + self.version = version + + +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 system_data: Metadata pertaining to creation and last modification of the resource. + :vartype system_data: ~azure.mgmt.appplatform.v2022_01_01_preview.models.SystemData + :ivar properties: Properties of the storage resource payload. + :vartype properties: ~azure.mgmt.appplatform.v2022_01_01_preview.models.StorageProperties + """ + + _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'}, + 'system_data': {'key': 'systemData', 'type': 'SystemData'}, + 'properties': {'key': 'properties', 'type': 'StorageProperties'}, + } + + def __init__( + self, + *, + properties: Optional["StorageProperties"] = None, + **kwargs + ): + """ + :keyword properties: Properties of the storage resource payload. + :paramtype properties: ~azure.mgmt.appplatform.v2022_01_01_preview.models.StorageProperties + """ + super(StorageResource, self).__init__(**kwargs) + self.properties = properties + + +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.v2022_01_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.v2022_01_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 SupportedBuildpackResource(ProxyResource): + """Supported buildpack 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 system_data: Metadata pertaining to creation and last modification of the resource. + :vartype system_data: ~azure.mgmt.appplatform.v2022_01_01_preview.models.SystemData + :ivar properties: Supported buildpack resource properties. + :vartype properties: + ~azure.mgmt.appplatform.v2022_01_01_preview.models.SupportedBuildpackResourceProperties + """ + + _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'}, + 'system_data': {'key': 'systemData', 'type': 'SystemData'}, + 'properties': {'key': 'properties', 'type': 'SupportedBuildpackResourceProperties'}, + } + + def __init__( + self, + *, + properties: Optional["SupportedBuildpackResourceProperties"] = None, + **kwargs + ): + """ + :keyword properties: Supported buildpack resource properties. + :paramtype properties: + ~azure.mgmt.appplatform.v2022_01_01_preview.models.SupportedBuildpackResourceProperties + """ + super(SupportedBuildpackResource, self).__init__(**kwargs) + self.properties = properties + + +class SupportedBuildpackResourceProperties(msrest.serialization.Model): + """Supported buildpack resource properties. + + :ivar buildpack_id: The id of supported buildpack. + :vartype buildpack_id: str + """ + + _attribute_map = { + 'buildpack_id': {'key': 'buildpackId', 'type': 'str'}, + } + + def __init__( + self, + *, + buildpack_id: Optional[str] = None, + **kwargs + ): + """ + :keyword buildpack_id: The id of supported buildpack. + :paramtype buildpack_id: str + """ + super(SupportedBuildpackResourceProperties, self).__init__(**kwargs) + self.buildpack_id = buildpack_id + + +class SupportedBuildpacksCollection(msrest.serialization.Model): + """Object that includes an array of supported buildpacks resources and a possible link for next set. + + :ivar value: Collection of supported buildpacks resources. + :vartype value: + list[~azure.mgmt.appplatform.v2022_01_01_preview.models.SupportedBuildpackResource] + :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': '[SupportedBuildpackResource]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + *, + value: Optional[List["SupportedBuildpackResource"]] = None, + next_link: Optional[str] = None, + **kwargs + ): + """ + :keyword value: Collection of supported buildpacks resources. + :paramtype value: + list[~azure.mgmt.appplatform.v2022_01_01_preview.models.SupportedBuildpackResource] + :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(SupportedBuildpacksCollection, 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", "Java_17", "NetCore_31". + :vartype value: str or ~azure.mgmt.appplatform.v2022_01_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.v2022_01_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", "Java_17", "NetCore_31". + :paramtype value: str or + ~azure.mgmt.appplatform.v2022_01_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.v2022_01_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 SupportedStackResource(ProxyResource): + """Supported stack 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 system_data: Metadata pertaining to creation and last modification of the resource. + :vartype system_data: ~azure.mgmt.appplatform.v2022_01_01_preview.models.SystemData + :ivar properties: Supported stack resource properties. + :vartype properties: + ~azure.mgmt.appplatform.v2022_01_01_preview.models.SupportedStackResourceProperties + """ + + _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'}, + 'system_data': {'key': 'systemData', 'type': 'SystemData'}, + 'properties': {'key': 'properties', 'type': 'SupportedStackResourceProperties'}, + } + + def __init__( + self, + *, + properties: Optional["SupportedStackResourceProperties"] = None, + **kwargs + ): + """ + :keyword properties: Supported stack resource properties. + :paramtype properties: + ~azure.mgmt.appplatform.v2022_01_01_preview.models.SupportedStackResourceProperties + """ + super(SupportedStackResource, self).__init__(**kwargs) + self.properties = properties + + +class SupportedStackResourceProperties(msrest.serialization.Model): + """Supported stack resource properties. + + :ivar stack_id: The id of supported stack. + :vartype stack_id: str + :ivar version: The version of supported stack. + :vartype version: str + """ + + _attribute_map = { + 'stack_id': {'key': 'stackId', 'type': 'str'}, + 'version': {'key': 'version', 'type': 'str'}, + } + + def __init__( + self, + *, + stack_id: Optional[str] = None, + version: Optional[str] = None, + **kwargs + ): + """ + :keyword stack_id: The id of supported stack. + :paramtype stack_id: str + :keyword version: The version of supported stack. + :paramtype version: str + """ + super(SupportedStackResourceProperties, self).__init__(**kwargs) + self.stack_id = stack_id + self.version = version + + +class SupportedStacksCollection(msrest.serialization.Model): + """Object that includes an array of supported stacks resources and a possible link for next set. + + :ivar value: Collection of supported stacks resources. + :vartype value: list[~azure.mgmt.appplatform.v2022_01_01_preview.models.SupportedStackResource] + :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': '[SupportedStackResource]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + *, + value: Optional[List["SupportedStackResource"]] = None, + next_link: Optional[str] = None, + **kwargs + ): + """ + :keyword value: Collection of supported stacks resources. + :paramtype value: + list[~azure.mgmt.appplatform.v2022_01_01_preview.models.SupportedStackResource] + :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(SupportedStacksCollection, self).__init__(**kwargs) + self.value = value + self.next_link = next_link + + +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.v2022_01_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.v2022_01_01_preview.models.LastModifiedByType + :ivar last_modified_at: The timestamp of resource 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, "LastModifiedByType"]] = 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.v2022_01_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.v2022_01_01_preview.models.LastModifiedByType + :keyword last_modified_at: The timestamp of resource 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 TriggeredBuildResult(msrest.serialization.Model): + """The build result triggered by a build. + + :ivar id: The unique build id of this build result. + :vartype id: str + """ + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + } + + def __init__( + self, + *, + id: Optional[str] = None, + **kwargs + ): + """ + :keyword id: The unique build id of this build result. + :paramtype id: str + """ + super(TriggeredBuildResult, self).__init__(**kwargs) + self.id = id + + +class ValidationMessages(msrest.serialization.Model): + """Validate messages of the configuration service git repositories. + + :ivar name: The name of the configuration service git repository. + :vartype name: str + :ivar messages: Detailed validation messages. + :vartype messages: list[str] + """ + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'messages': {'key': 'messages', 'type': '[str]'}, + } + + def __init__( + self, + *, + name: Optional[str] = None, + messages: Optional[List[str]] = None, + **kwargs + ): + """ + :keyword name: The name of the configuration service git repository. + :paramtype name: str + :keyword messages: Detailed validation messages. + :paramtype messages: list[str] + """ + super(ValidationMessages, self).__init__(**kwargs) + self.name = name + self.messages = messages diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_01_01_preview/operations/__init__.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_01_01_preview/operations/__init__.py new file mode 100644 index 000000000000..0da100b4246c --- /dev/null +++ b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_01_01_preview/operations/__init__.py @@ -0,0 +1,57 @@ +# 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 ._configuration_services_operations import ConfigurationServicesOperations +from ._service_registries_operations import ServiceRegistriesOperations +from ._build_service_operations import BuildServiceOperations +from ._buildpack_binding_operations import BuildpackBindingOperations +from ._build_service_builder_operations import BuildServiceBuilderOperations +from ._build_service_agent_pool_operations import BuildServiceAgentPoolOperations +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 +from ._gateways_operations import GatewaysOperations +from ._gateway_route_configs_operations import GatewayRouteConfigsOperations +from ._gateway_custom_domains_operations import GatewayCustomDomainsOperations +from ._api_portals_operations import ApiPortalsOperations +from ._api_portal_custom_domains_operations import ApiPortalCustomDomainsOperations + +__all__ = [ + 'ServicesOperations', + 'ConfigServersOperations', + 'ConfigurationServicesOperations', + 'ServiceRegistriesOperations', + 'BuildServiceOperations', + 'BuildpackBindingOperations', + 'BuildServiceBuilderOperations', + 'BuildServiceAgentPoolOperations', + 'MonitoringSettingsOperations', + 'AppsOperations', + 'BindingsOperations', + 'StoragesOperations', + 'CertificatesOperations', + 'CustomDomainsOperations', + 'DeploymentsOperations', + 'Operations', + 'RuntimeVersionsOperations', + 'SkusOperations', + 'GatewaysOperations', + 'GatewayRouteConfigsOperations', + 'GatewayCustomDomainsOperations', + 'ApiPortalsOperations', + 'ApiPortalCustomDomainsOperations', +] diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_01_01_preview/operations/_api_portal_custom_domains_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_01_01_preview/operations/_api_portal_custom_domains_operations.py new file mode 100644 index 000000000000..84e1d44b733e --- /dev/null +++ b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_01_01_preview/operations/_api_portal_custom_domains_operations.py @@ -0,0 +1,600 @@ +# 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, Iterable, Optional, TypeVar, Union +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 +T = TypeVar('T') +JSONType = Any +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_get_request( + subscription_id: str, + resource_group_name: str, + service_name: str, + api_portal_name: str, + domain_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2022-01-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apiPortals/{apiPortalName}/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'), + "apiPortalName": _SERIALIZER.url("api_portal_name", api_portal_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: str, + resource_group_name: str, + service_name: str, + api_portal_name: str, + domain_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2022-01-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apiPortals/{apiPortalName}/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'), + "apiPortalName": _SERIALIZER.url("api_portal_name", api_portal_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, + json=json, + content=content, + **kwargs + ) + + +def build_delete_request_initial( + subscription_id: str, + resource_group_name: str, + service_name: str, + api_portal_name: str, + domain_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2022-01-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apiPortals/{apiPortalName}/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'), + "apiPortalName": _SERIALIZER.url("api_portal_name", api_portal_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_list_request( + subscription_id: str, + resource_group_name: str, + service_name: str, + api_portal_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2022-01-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apiPortals/{apiPortalName}/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'), + "apiPortalName": _SERIALIZER.url("api_portal_name", api_portal_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 + ) + +class ApiPortalCustomDomainsOperations(object): + """ApiPortalCustomDomainsOperations 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.v2022_01_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: str, + service_name: str, + api_portal_name: str, + domain_name: str, + **kwargs: Any + ) -> "_models.ApiPortalCustomDomainResource": + """Get the API portal custom domain. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. + :type resource_group_name: str + :param service_name: The name of the Service resource. + :type service_name: str + :param api_portal_name: The name of API portal. + :type api_portal_name: str + :param domain_name: The name of the API portal custom domain. + :type domain_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ApiPortalCustomDomainResource, or the result of cls(response) + :rtype: ~azure.mgmt.appplatform.v2022_01_01_preview.models.ApiPortalCustomDomainResource + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.ApiPortalCustomDomainResource"] + 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, + api_portal_name=api_portal_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('ApiPortalCustomDomainResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apiPortals/{apiPortalName}/domains/{domainName}'} # type: ignore + + + def _create_or_update_initial( + self, + resource_group_name: str, + service_name: str, + api_portal_name: str, + domain_name: str, + api_portal_custom_domain_resource: "_models.ApiPortalCustomDomainResource", + **kwargs: Any + ) -> "_models.ApiPortalCustomDomainResource": + cls = kwargs.pop('cls', None) # type: ClsType["_models.ApiPortalCustomDomainResource"] + 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(api_portal_custom_domain_resource, 'ApiPortalCustomDomainResource') + + request = build_create_or_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + api_portal_name=api_portal_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]: + 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('ApiPortalCustomDomainResource', pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize('ApiPortalCustomDomainResource', 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}/apiPortals/{apiPortalName}/domains/{domainName}'} # type: ignore + + + @distributed_trace + def begin_create_or_update( + self, + resource_group_name: str, + service_name: str, + api_portal_name: str, + domain_name: str, + api_portal_custom_domain_resource: "_models.ApiPortalCustomDomainResource", + **kwargs: Any + ) -> LROPoller["_models.ApiPortalCustomDomainResource"]: + """Create or update the API portal custom domain. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. + :type resource_group_name: str + :param service_name: The name of the Service resource. + :type service_name: str + :param api_portal_name: The name of API portal. + :type api_portal_name: str + :param domain_name: The name of the API portal custom domain. + :type domain_name: str + :param api_portal_custom_domain_resource: The API portal custom domain for the create or update + operation. + :type api_portal_custom_domain_resource: + ~azure.mgmt.appplatform.v2022_01_01_preview.models.ApiPortalCustomDomainResource + :keyword callable cls: A custom type or function that will be passed the direct response + :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 ApiPortalCustomDomainResource or the + result of cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2022_01_01_preview.models.ApiPortalCustomDomainResource] + :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.ApiPortalCustomDomainResource"] + 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, + api_portal_name=api_portal_name, + domain_name=domain_name, + api_portal_custom_domain_resource=api_portal_custom_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('ApiPortalCustomDomainResource', 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}/apiPortals/{apiPortalName}/domains/{domainName}'} # type: ignore + + def _delete_initial( + self, + resource_group_name: str, + service_name: str, + api_portal_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, + api_portal_name=api_portal_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}/apiPortals/{apiPortalName}/domains/{domainName}'} # type: ignore + + + @distributed_trace + def begin_delete( + self, + resource_group_name: str, + service_name: str, + api_portal_name: str, + domain_name: str, + **kwargs: Any + ) -> LROPoller[None]: + """Delete the API portal custom domain. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. + :type resource_group_name: str + :param service_name: The name of the Service resource. + :type service_name: str + :param api_portal_name: The name of API portal. + :type api_portal_name: str + :param domain_name: The name of the API portal custom domain. + :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, + api_portal_name=api_portal_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}/apiPortals/{apiPortalName}/domains/{domainName}'} # type: ignore + + @distributed_trace + def list( + self, + resource_group_name: str, + service_name: str, + api_portal_name: str, + **kwargs: Any + ) -> Iterable["_models.ApiPortalCustomDomainResourceCollection"]: + """Handle requests to list all API portal custom domains. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. + :type resource_group_name: str + :param service_name: The name of the Service resource. + :type service_name: str + :param api_portal_name: The name of API portal. + :type api_portal_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either ApiPortalCustomDomainResourceCollection or the + result of cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2022_01_01_preview.models.ApiPortalCustomDomainResourceCollection] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.ApiPortalCustomDomainResourceCollection"] + 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, + api_portal_name=api_portal_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, + api_portal_name=api_portal_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("ApiPortalCustomDomainResourceCollection", 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}/apiPortals/{apiPortalName}/domains'} # type: ignore diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_01_01_preview/operations/_api_portals_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_01_01_preview/operations/_api_portals_operations.py new file mode 100644 index 000000000000..a90b9a358308 --- /dev/null +++ b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_01_01_preview/operations/_api_portals_operations.py @@ -0,0 +1,680 @@ +# 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, Iterable, Optional, TypeVar, Union +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 +T = TypeVar('T') +JSONType = Any +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_get_request( + subscription_id: str, + resource_group_name: str, + service_name: str, + api_portal_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2022-01-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apiPortals/{apiPortalName}') + 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'), + "apiPortalName": _SERIALIZER.url("api_portal_name", api_portal_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: str, + resource_group_name: str, + service_name: str, + api_portal_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2022-01-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apiPortals/{apiPortalName}') + 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'), + "apiPortalName": _SERIALIZER.url("api_portal_name", api_portal_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, + json=json, + content=content, + **kwargs + ) + + +def build_delete_request_initial( + subscription_id: str, + resource_group_name: str, + service_name: str, + api_portal_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2022-01-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apiPortals/{apiPortalName}') + 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'), + "apiPortalName": _SERIALIZER.url("api_portal_name", api_portal_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: str, + resource_group_name: str, + service_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2022-01-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apiPortals') + 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_validate_domain_request( + subscription_id: str, + resource_group_name: str, + service_name: str, + api_portal_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2022-01-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apiPortals/{apiPortalName}/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'), + "apiPortalName": _SERIALIZER.url("api_portal_name", api_portal_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, + json=json, + content=content, + **kwargs + ) + +class ApiPortalsOperations(object): + """ApiPortalsOperations 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.v2022_01_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: str, + service_name: str, + api_portal_name: str, + **kwargs: Any + ) -> "_models.ApiPortalResource": + """Get the API portal 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 api_portal_name: The name of API portal. + :type api_portal_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ApiPortalResource, or the result of cls(response) + :rtype: ~azure.mgmt.appplatform.v2022_01_01_preview.models.ApiPortalResource + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.ApiPortalResource"] + 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, + api_portal_name=api_portal_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('ApiPortalResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apiPortals/{apiPortalName}'} # type: ignore + + + def _create_or_update_initial( + self, + resource_group_name: str, + service_name: str, + api_portal_name: str, + api_portal_resource: "_models.ApiPortalResource", + **kwargs: Any + ) -> "_models.ApiPortalResource": + cls = kwargs.pop('cls', None) # type: ClsType["_models.ApiPortalResource"] + 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(api_portal_resource, 'ApiPortalResource') + + request = build_create_or_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + api_portal_name=api_portal_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]: + 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('ApiPortalResource', pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize('ApiPortalResource', 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}/apiPortals/{apiPortalName}'} # type: ignore + + + @distributed_trace + def begin_create_or_update( + self, + resource_group_name: str, + service_name: str, + api_portal_name: str, + api_portal_resource: "_models.ApiPortalResource", + **kwargs: Any + ) -> LROPoller["_models.ApiPortalResource"]: + """Create the default API portal or update the existing API portal. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. + :type resource_group_name: str + :param service_name: The name of the Service resource. + :type service_name: str + :param api_portal_name: The name of API portal. + :type api_portal_name: str + :param api_portal_resource: The API portal for the create or update operation. + :type api_portal_resource: ~azure.mgmt.appplatform.v2022_01_01_preview.models.ApiPortalResource + :keyword callable cls: A custom type or function that will be passed the direct response + :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 ApiPortalResource or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2022_01_01_preview.models.ApiPortalResource] + :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.ApiPortalResource"] + 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, + api_portal_name=api_portal_name, + api_portal_resource=api_portal_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('ApiPortalResource', 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}/apiPortals/{apiPortalName}'} # type: ignore + + def _delete_initial( + self, + resource_group_name: str, + service_name: str, + api_portal_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, + api_portal_name=api_portal_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}/apiPortals/{apiPortalName}'} # type: ignore + + + @distributed_trace + def begin_delete( + self, + resource_group_name: str, + service_name: str, + api_portal_name: str, + **kwargs: Any + ) -> LROPoller[None]: + """Delete the default API portal. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. + :type resource_group_name: str + :param service_name: The name of the Service resource. + :type service_name: str + :param api_portal_name: The name of API portal. + :type api_portal_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, + api_portal_name=api_portal_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}/apiPortals/{apiPortalName}'} # type: ignore + + @distributed_trace + def list( + self, + resource_group_name: str, + service_name: str, + **kwargs: Any + ) -> Iterable["_models.ApiPortalResourceCollection"]: + """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 ApiPortalResourceCollection or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2022_01_01_preview.models.ApiPortalResourceCollection] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.ApiPortalResourceCollection"] + 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("ApiPortalResourceCollection", 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}/apiPortals'} # type: ignore + + @distributed_trace + def validate_domain( + self, + resource_group_name: str, + service_name: str, + api_portal_name: str, + validate_payload: "_models.CustomDomainValidatePayload", + **kwargs: Any + ) -> "_models.CustomDomainValidateResult": + """Check the domains are 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 api_portal_name: The name of API portal. + :type api_portal_name: str + :param validate_payload: Custom domain payload to be validated. + :type validate_payload: + ~azure.mgmt.appplatform.v2022_01_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.v2022_01_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, + api_portal_name=api_portal_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}/apiPortals/{apiPortalName}/validateDomain'} # type: ignore + diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_01_01_preview/operations/_apps_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_01_01_preview/operations/_apps_operations.py new file mode 100644 index 000000000000..c987af6cc9de --- /dev/null +++ b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_01_01_preview/operations/_apps_operations.py @@ -0,0 +1,1133 @@ +# 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, Iterable, Optional, TypeVar, Union +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 +T = TypeVar('T') +JSONType = Any +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_get_request( + subscription_id: str, + resource_group_name: str, + service_name: str, + app_name: str, + *, + sync_status: Optional[str] = None, + **kwargs: Any +) -> HttpRequest: + api_version = "2022-01-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: str, + resource_group_name: str, + service_name: str, + app_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2022-01-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, + json=json, + content=content, + **kwargs + ) + + +def build_delete_request_initial( + subscription_id: str, + resource_group_name: str, + service_name: str, + app_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2022-01-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: str, + resource_group_name: str, + service_name: str, + app_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2022-01-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, + json=json, + content=content, + **kwargs + ) + + +def build_list_request( + subscription_id: str, + resource_group_name: str, + service_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2022-01-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: str, + resource_group_name: str, + service_name: str, + app_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2022-01-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_set_active_deployments_request_initial( + subscription_id: str, + resource_group_name: str, + service_name: str, + app_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2022-01-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/setActiveDeployments') + 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, + json=json, + content=content, + **kwargs + ) + + +def build_validate_domain_request( + subscription_id: str, + resource_group_name: str, + service_name: str, + app_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2022-01-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, + json=json, + content=content, + **kwargs + ) + +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.v2022_01_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: 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.v2022_01_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: 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 = 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: str, + service_name: str, + app_name: str, + app_resource: "_models.AppResource", + **kwargs: Any + ) -> 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.v2022_01_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.v2022_01_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: 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 = 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: str, + service_name: str, + app_name: str, + **kwargs: Any + ) -> 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: 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 = 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: str, + service_name: str, + app_name: str, + app_resource: "_models.AppResource", + **kwargs: Any + ) -> 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.v2022_01_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.v2022_01_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: str, + service_name: str, + **kwargs: Any + ) -> 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.v2022_01_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: 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.v2022_01_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 + + + def _set_active_deployments_initial( + self, + resource_group_name: str, + service_name: str, + app_name: str, + active_deployment_collection: "_models.ActiveDeploymentCollection", + **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(active_deployment_collection, 'ActiveDeploymentCollection') + + request = build_set_active_deployments_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._set_active_deployments_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 + + _set_active_deployments_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/setActiveDeployments'} # type: ignore + + + @distributed_trace + def begin_set_active_deployments( + self, + resource_group_name: str, + service_name: str, + app_name: str, + active_deployment_collection: "_models.ActiveDeploymentCollection", + **kwargs: Any + ) -> LROPoller["_models.AppResource"]: + """Set existing Deployment under the app as active. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource 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 active_deployment_collection: A list of Deployment name to be active. + :type active_deployment_collection: + ~azure.mgmt.appplatform.v2022_01_01_preview.models.ActiveDeploymentCollection + :keyword callable cls: A custom type or function that will be passed the direct response + :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.v2022_01_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._set_active_deployments_initial( + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + active_deployment_collection=active_deployment_collection, + 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_set_active_deployments.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/setActiveDeployments'} # type: ignore + + @distributed_trace + 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.v2022_01_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.v2022_01_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/v2022_01_01_preview/operations/_bindings_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_01_01_preview/operations/_bindings_operations.py new file mode 100644 index 000000000000..2f277dcb60d0 --- /dev/null +++ b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_01_01_preview/operations/_bindings_operations.py @@ -0,0 +1,783 @@ +# 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, Iterable, Optional, TypeVar, Union +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 +T = TypeVar('T') +JSONType = Any +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_get_request( + subscription_id: str, + resource_group_name: str, + service_name: str, + app_name: str, + binding_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2022-01-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: str, + resource_group_name: str, + service_name: str, + app_name: str, + binding_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2022-01-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, + json=json, + content=content, + **kwargs + ) + + +def build_delete_request_initial( + subscription_id: str, + resource_group_name: str, + service_name: str, + app_name: str, + binding_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2022-01-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: str, + resource_group_name: str, + service_name: str, + app_name: str, + binding_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2022-01-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, + json=json, + content=content, + **kwargs + ) + + +def build_list_request( + subscription_id: str, + resource_group_name: str, + service_name: str, + app_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2022-01-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 + ) + +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.v2022_01_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: 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.v2022_01_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: 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 = 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: str, + service_name: str, + app_name: str, + binding_name: str, + binding_resource: "_models.BindingResource", + **kwargs: Any + ) -> 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.v2022_01_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.v2022_01_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: 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 = 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: str, + service_name: str, + app_name: str, + binding_name: str, + **kwargs: Any + ) -> 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: 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 = 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: str, + service_name: str, + app_name: str, + binding_name: str, + binding_resource: "_models.BindingResource", + **kwargs: Any + ) -> 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.v2022_01_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.v2022_01_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: str, + service_name: str, + app_name: str, + **kwargs: Any + ) -> 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.v2022_01_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/v2022_01_01_preview/operations/_build_service_agent_pool_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_01_01_preview/operations/_build_service_agent_pool_operations.py new file mode 100644 index 000000000000..d6eb2b167d6f --- /dev/null +++ b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_01_01_preview/operations/_build_service_agent_pool_operations.py @@ -0,0 +1,451 @@ +# 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, Iterable, Optional, TypeVar, Union +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 +T = TypeVar('T') +JSONType = Any +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_list_request( + subscription_id: str, + resource_group_name: str, + service_name: str, + build_service_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2022-01-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/agentPools') + 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'), + "buildServiceName": _SERIALIZER.url("build_service_name", build_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_request( + subscription_id: str, + resource_group_name: str, + service_name: str, + build_service_name: str, + agent_pool_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2022-01-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/agentPools/{agentPoolName}') + 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'), + "buildServiceName": _SERIALIZER.url("build_service_name", build_service_name, 'str'), + "agentPoolName": _SERIALIZER.url("agent_pool_name", agent_pool_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: str, + resource_group_name: str, + service_name: str, + build_service_name: str, + agent_pool_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2022-01-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/agentPools/{agentPoolName}') + 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'), + "buildServiceName": _SERIALIZER.url("build_service_name", build_service_name, 'str'), + "agentPoolName": _SERIALIZER.url("agent_pool_name", agent_pool_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, + json=json, + content=content, + **kwargs + ) + +class BuildServiceAgentPoolOperations(object): + """BuildServiceAgentPoolOperations 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.v2022_01_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, + resource_group_name: str, + service_name: str, + build_service_name: str, + **kwargs: Any + ) -> Iterable["_models.BuildServiceAgentPoolResourceCollection"]: + """List build service agent pool. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. + :type resource_group_name: str + :param service_name: The name of the Service resource. + :type service_name: str + :param build_service_name: The name of the build service resource. + :type build_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 BuildServiceAgentPoolResourceCollection or the + result of cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2022_01_01_preview.models.BuildServiceAgentPoolResourceCollection] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.BuildServiceAgentPoolResourceCollection"] + 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, + build_service_name=build_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, + build_service_name=build_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("BuildServiceAgentPoolResourceCollection", 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}/buildServices/{buildServiceName}/agentPools'} # type: ignore + + @distributed_trace + def get( + self, + resource_group_name: str, + service_name: str, + build_service_name: str, + agent_pool_name: str, + **kwargs: Any + ) -> "_models.BuildServiceAgentPoolResource": + """Get build service agent pool. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. + :type resource_group_name: str + :param service_name: The name of the Service resource. + :type service_name: str + :param build_service_name: The name of the build service resource. + :type build_service_name: str + :param agent_pool_name: The name of the build service agent pool resource. + :type agent_pool_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: BuildServiceAgentPoolResource, or the result of cls(response) + :rtype: ~azure.mgmt.appplatform.v2022_01_01_preview.models.BuildServiceAgentPoolResource + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.BuildServiceAgentPoolResource"] + 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, + build_service_name=build_service_name, + agent_pool_name=agent_pool_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('BuildServiceAgentPoolResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/agentPools/{agentPoolName}'} # type: ignore + + + def _update_put_initial( + self, + resource_group_name: str, + service_name: str, + build_service_name: str, + agent_pool_name: str, + agent_pool_resource: "_models.BuildServiceAgentPoolResource", + **kwargs: Any + ) -> "_models.BuildServiceAgentPoolResource": + cls = kwargs.pop('cls', None) # type: ClsType["_models.BuildServiceAgentPoolResource"] + 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(agent_pool_resource, 'BuildServiceAgentPoolResource') + + request = build_update_put_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + build_service_name=build_service_name, + agent_pool_name=agent_pool_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, 201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize('BuildServiceAgentPoolResource', pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize('BuildServiceAgentPoolResource', 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}/buildServices/{buildServiceName}/agentPools/{agentPoolName}'} # type: ignore + + + @distributed_trace + def begin_update_put( + self, + resource_group_name: str, + service_name: str, + build_service_name: str, + agent_pool_name: str, + agent_pool_resource: "_models.BuildServiceAgentPoolResource", + **kwargs: Any + ) -> LROPoller["_models.BuildServiceAgentPoolResource"]: + """Create or update build service agent pool. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. + :type resource_group_name: str + :param service_name: The name of the Service resource. + :type service_name: str + :param build_service_name: The name of the build service resource. + :type build_service_name: str + :param agent_pool_name: The name of the build service agent pool resource. + :type agent_pool_name: str + :param agent_pool_resource: Parameters for the update operation. + :type agent_pool_resource: + ~azure.mgmt.appplatform.v2022_01_01_preview.models.BuildServiceAgentPoolResource + :keyword callable cls: A custom type or function that will be passed the direct response + :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 BuildServiceAgentPoolResource or the + result of cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2022_01_01_preview.models.BuildServiceAgentPoolResource] + :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.BuildServiceAgentPoolResource"] + 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, + build_service_name=build_service_name, + agent_pool_name=agent_pool_name, + agent_pool_resource=agent_pool_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('BuildServiceAgentPoolResource', 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}/buildServices/{buildServiceName}/agentPools/{agentPoolName}'} # type: ignore diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_01_01_preview/operations/_build_service_builder_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_01_01_preview/operations/_build_service_builder_operations.py new file mode 100644 index 000000000000..295709302e46 --- /dev/null +++ b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_01_01_preview/operations/_build_service_builder_operations.py @@ -0,0 +1,598 @@ +# 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, Iterable, Optional, TypeVar, Union +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 +T = TypeVar('T') +JSONType = Any +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_get_request( + subscription_id: str, + resource_group_name: str, + service_name: str, + build_service_name: str, + builder_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2022-01-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/builders/{builderName}') + 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'), + "buildServiceName": _SERIALIZER.url("build_service_name", build_service_name, 'str'), + "builderName": _SERIALIZER.url("builder_name", builder_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: str, + resource_group_name: str, + service_name: str, + build_service_name: str, + builder_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2022-01-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/builders/{builderName}') + 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'), + "buildServiceName": _SERIALIZER.url("build_service_name", build_service_name, 'str'), + "builderName": _SERIALIZER.url("builder_name", builder_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, + json=json, + content=content, + **kwargs + ) + + +def build_delete_request_initial( + subscription_id: str, + resource_group_name: str, + service_name: str, + build_service_name: str, + builder_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2022-01-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/builders/{builderName}') + 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'), + "buildServiceName": _SERIALIZER.url("build_service_name", build_service_name, 'str'), + "builderName": _SERIALIZER.url("builder_name", builder_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: str, + resource_group_name: str, + service_name: str, + build_service_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2022-01-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/builders') + 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'), + "buildServiceName": _SERIALIZER.url("build_service_name", build_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 + ) + +class BuildServiceBuilderOperations(object): + """BuildServiceBuilderOperations 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.v2022_01_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: str, + service_name: str, + build_service_name: str, + builder_name: str, + **kwargs: Any + ) -> "_models.BuilderResource": + """Get a KPack builder. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. + :type resource_group_name: str + :param service_name: The name of the Service resource. + :type service_name: str + :param build_service_name: The name of the build service resource. + :type build_service_name: str + :param builder_name: The name of the builder resource. + :type builder_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: BuilderResource, or the result of cls(response) + :rtype: ~azure.mgmt.appplatform.v2022_01_01_preview.models.BuilderResource + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.BuilderResource"] + 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, + build_service_name=build_service_name, + builder_name=builder_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('BuilderResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/builders/{builderName}'} # type: ignore + + + def _create_or_update_initial( + self, + resource_group_name: str, + service_name: str, + build_service_name: str, + builder_name: str, + builder_resource: "_models.BuilderResource", + **kwargs: Any + ) -> "_models.BuilderResource": + cls = kwargs.pop('cls', None) # type: ClsType["_models.BuilderResource"] + 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(builder_resource, 'BuilderResource') + + request = build_create_or_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + build_service_name=build_service_name, + builder_name=builder_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]: + 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('BuilderResource', pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize('BuilderResource', 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}/buildServices/{buildServiceName}/builders/{builderName}'} # type: ignore + + + @distributed_trace + def begin_create_or_update( + self, + resource_group_name: str, + service_name: str, + build_service_name: str, + builder_name: str, + builder_resource: "_models.BuilderResource", + **kwargs: Any + ) -> LROPoller["_models.BuilderResource"]: + """Create or update a KPack builder. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. + :type resource_group_name: str + :param service_name: The name of the Service resource. + :type service_name: str + :param build_service_name: The name of the build service resource. + :type build_service_name: str + :param builder_name: The name of the builder resource. + :type builder_name: str + :param builder_resource: The target builder for the create or update operation. + :type builder_resource: ~azure.mgmt.appplatform.v2022_01_01_preview.models.BuilderResource + :keyword callable cls: A custom type or function that will be passed the direct response + :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 BuilderResource or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2022_01_01_preview.models.BuilderResource] + :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.BuilderResource"] + 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, + build_service_name=build_service_name, + builder_name=builder_name, + builder_resource=builder_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('BuilderResource', 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}/buildServices/{buildServiceName}/builders/{builderName}'} # type: ignore + + def _delete_initial( + self, + resource_group_name: str, + service_name: str, + build_service_name: str, + builder_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, + build_service_name=build_service_name, + builder_name=builder_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}/buildServices/{buildServiceName}/builders/{builderName}'} # type: ignore + + + @distributed_trace + def begin_delete( + self, + resource_group_name: str, + service_name: str, + build_service_name: str, + builder_name: str, + **kwargs: Any + ) -> LROPoller[None]: + """Delete a KPack builder. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. + :type resource_group_name: str + :param service_name: The name of the Service resource. + :type service_name: str + :param build_service_name: The name of the build service resource. + :type build_service_name: str + :param builder_name: The name of the builder resource. + :type builder_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, + build_service_name=build_service_name, + builder_name=builder_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}/buildServices/{buildServiceName}/builders/{builderName}'} # type: ignore + + @distributed_trace + def list( + self, + resource_group_name: str, + service_name: str, + build_service_name: str, + **kwargs: Any + ) -> Iterable["_models.BuilderResourceCollection"]: + """List KPack builders result. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. + :type resource_group_name: str + :param service_name: The name of the Service resource. + :type service_name: str + :param build_service_name: The name of the build service resource. + :type build_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 BuilderResourceCollection or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2022_01_01_preview.models.BuilderResourceCollection] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.BuilderResourceCollection"] + 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, + build_service_name=build_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, + build_service_name=build_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("BuilderResourceCollection", 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}/buildServices/{buildServiceName}/builders'} # type: ignore diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_01_01_preview/operations/_build_service_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_01_01_preview/operations/_build_service_operations.py new file mode 100644 index 000000000000..66e31304c5a3 --- /dev/null +++ b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_01_01_preview/operations/_build_service_operations.py @@ -0,0 +1,1401 @@ +# 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, Iterable, Optional, TypeVar, Union +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 +T = TypeVar('T') +JSONType = Any +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_list_build_services_request( + subscription_id: str, + resource_group_name: str, + service_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2022-01-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices') + 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_build_service_request( + subscription_id: str, + resource_group_name: str, + service_name: str, + build_service_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2022-01-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}') + 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'), + "buildServiceName": _SERIALIZER.url("build_service_name", build_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_list_builds_request( + subscription_id: str, + resource_group_name: str, + service_name: str, + build_service_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2022-01-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/builds') + 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'), + "buildServiceName": _SERIALIZER.url("build_service_name", build_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_build_request( + subscription_id: str, + resource_group_name: str, + service_name: str, + build_service_name: str, + build_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2022-01-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/builds/{buildName}') + 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'), + "buildServiceName": _SERIALIZER.url("build_service_name", build_service_name, 'str'), + "buildName": _SERIALIZER.url("build_name", build_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_build_request( + subscription_id: str, + resource_group_name: str, + service_name: str, + build_service_name: str, + build_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2022-01-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/builds/{buildName}') + 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'), + "buildServiceName": _SERIALIZER.url("build_service_name", build_service_name, 'str'), + "buildName": _SERIALIZER.url("build_name", build_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, + json=json, + content=content, + **kwargs + ) + + +def build_list_build_results_request( + subscription_id: str, + resource_group_name: str, + service_name: str, + build_service_name: str, + build_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2022-01-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/builds/{buildName}/results') + 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'), + "buildServiceName": _SERIALIZER.url("build_service_name", build_service_name, 'str'), + "buildName": _SERIALIZER.url("build_name", build_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_build_result_request( + subscription_id: str, + resource_group_name: str, + service_name: str, + build_service_name: str, + build_name: str, + build_result_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2022-01-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/builds/{buildName}/results/{buildResultName}') + 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'), + "buildServiceName": _SERIALIZER.url("build_service_name", build_service_name, 'str'), + "buildName": _SERIALIZER.url("build_name", build_name, 'str'), + "buildResultName": _SERIALIZER.url("build_result_name", build_result_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_build_result_log_request( + subscription_id: str, + resource_group_name: str, + service_name: str, + build_service_name: str, + build_name: str, + build_result_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2022-01-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/builds/{buildName}/results/{buildResultName}/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'), + "buildServiceName": _SERIALIZER.url("build_service_name", build_service_name, 'str'), + "buildName": _SERIALIZER.url("build_name", build_name, 'str'), + "buildResultName": _SERIALIZER.url("build_result_name", build_result_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_resource_upload_url_request( + subscription_id: str, + resource_group_name: str, + service_name: str, + build_service_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2022-01-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/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'), + "buildServiceName": _SERIALIZER.url("build_service_name", build_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_list_supported_buildpacks_request( + subscription_id: str, + resource_group_name: str, + service_name: str, + build_service_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2022-01-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/supportedBuildpacks') + 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'), + "buildServiceName": _SERIALIZER.url("build_service_name", build_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_supported_buildpack_request( + subscription_id: str, + resource_group_name: str, + service_name: str, + build_service_name: str, + buildpack_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2022-01-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/supportedBuildpacks/{buildpackName}') + 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'), + "buildServiceName": _SERIALIZER.url("build_service_name", build_service_name, 'str'), + "buildpackName": _SERIALIZER.url("buildpack_name", buildpack_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_list_supported_stacks_request( + subscription_id: str, + resource_group_name: str, + service_name: str, + build_service_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2022-01-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/supportedStacks') + 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'), + "buildServiceName": _SERIALIZER.url("build_service_name", build_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_supported_stack_request( + subscription_id: str, + resource_group_name: str, + service_name: str, + build_service_name: str, + stack_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2022-01-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/supportedStacks/{stackName}') + 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'), + "buildServiceName": _SERIALIZER.url("build_service_name", build_service_name, 'str'), + "stackName": _SERIALIZER.url("stack_name", stack_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 + ) + +class BuildServiceOperations(object): + """BuildServiceOperations 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.v2022_01_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_build_services( + self, + resource_group_name: str, + service_name: str, + **kwargs: Any + ) -> Iterable["_models.BuildServiceCollection"]: + """List build services 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 + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either BuildServiceCollection or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2022_01_01_preview.models.BuildServiceCollection] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.BuildServiceCollection"] + 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_build_services_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + template_url=self.list_build_services.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + + request = build_list_build_services_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("BuildServiceCollection", 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_build_services.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices'} # type: ignore + + @distributed_trace + def get_build_service( + self, + resource_group_name: str, + service_name: str, + build_service_name: str, + **kwargs: Any + ) -> "_models.BuildService": + """Get a build service 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 build_service_name: The name of the build service resource. + :type build_service_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: BuildService, or the result of cls(response) + :rtype: ~azure.mgmt.appplatform.v2022_01_01_preview.models.BuildService + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.BuildService"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_get_build_service_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + build_service_name=build_service_name, + template_url=self.get_build_service.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('BuildService', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get_build_service.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}'} # type: ignore + + + @distributed_trace + def list_builds( + self, + resource_group_name: str, + service_name: str, + build_service_name: str, + **kwargs: Any + ) -> Iterable["_models.BuildCollection"]: + """List KPack builds. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. + :type resource_group_name: str + :param service_name: The name of the Service resource. + :type service_name: str + :param build_service_name: The name of the build service resource. + :type build_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 BuildCollection or the result of cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2022_01_01_preview.models.BuildCollection] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.BuildCollection"] + 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_builds_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + build_service_name=build_service_name, + template_url=self.list_builds.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + + request = build_list_builds_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + build_service_name=build_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("BuildCollection", 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_builds.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/builds'} # type: ignore + + @distributed_trace + def get_build( + self, + resource_group_name: str, + service_name: str, + build_service_name: str, + build_name: str, + **kwargs: Any + ) -> "_models.Build": + """Get a KPack build. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. + :type resource_group_name: str + :param service_name: The name of the Service resource. + :type service_name: str + :param build_service_name: The name of the build service resource. + :type build_service_name: str + :param build_name: The name of the build resource. + :type build_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Build, or the result of cls(response) + :rtype: ~azure.mgmt.appplatform.v2022_01_01_preview.models.Build + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.Build"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_get_build_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + build_service_name=build_service_name, + build_name=build_name, + template_url=self.get_build.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('Build', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get_build.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/builds/{buildName}'} # type: ignore + + + @distributed_trace + def create_or_update_build( + self, + resource_group_name: str, + service_name: str, + build_service_name: str, + build_name: str, + build: "_models.Build", + **kwargs: Any + ) -> "_models.Build": + """Create or update a KPack build. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. + :type resource_group_name: str + :param service_name: The name of the Service resource. + :type service_name: str + :param build_service_name: The name of the build service resource. + :type build_service_name: str + :param build_name: The name of the build resource. + :type build_name: str + :param build: Parameters for the create or update operation. + :type build: ~azure.mgmt.appplatform.v2022_01_01_preview.models.Build + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Build, or the result of cls(response) + :rtype: ~azure.mgmt.appplatform.v2022_01_01_preview.models.Build + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.Build"] + 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(build, 'Build') + + request = build_create_or_update_build_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + build_service_name=build_service_name, + build_name=build_name, + content_type=content_type, + json=_json, + template_url=self.create_or_update_build.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]: + 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('Build', pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize('Build', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + create_or_update_build.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/builds/{buildName}'} # type: ignore + + + @distributed_trace + def list_build_results( + self, + resource_group_name: str, + service_name: str, + build_service_name: str, + build_name: str, + **kwargs: Any + ) -> Iterable["_models.BuildResultCollection"]: + """List KPack build results. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. + :type resource_group_name: str + :param service_name: The name of the Service resource. + :type service_name: str + :param build_service_name: The name of the build service resource. + :type build_service_name: str + :param build_name: The name of the build resource. + :type build_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either BuildResultCollection or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2022_01_01_preview.models.BuildResultCollection] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.BuildResultCollection"] + 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_build_results_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + build_service_name=build_service_name, + build_name=build_name, + template_url=self.list_build_results.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + + request = build_list_build_results_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + build_service_name=build_service_name, + build_name=build_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("BuildResultCollection", 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_build_results.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/builds/{buildName}/results'} # type: ignore + + @distributed_trace + def get_build_result( + self, + resource_group_name: str, + service_name: str, + build_service_name: str, + build_name: str, + build_result_name: str, + **kwargs: Any + ) -> "_models.BuildResult": + """Get a KPack build result. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. + :type resource_group_name: str + :param service_name: The name of the Service resource. + :type service_name: str + :param build_service_name: The name of the build service resource. + :type build_service_name: str + :param build_name: The name of the build resource. + :type build_name: str + :param build_result_name: The name of the build result resource. + :type build_result_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: BuildResult, or the result of cls(response) + :rtype: ~azure.mgmt.appplatform.v2022_01_01_preview.models.BuildResult + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.BuildResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_get_build_result_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + build_service_name=build_service_name, + build_name=build_name, + build_result_name=build_result_name, + template_url=self.get_build_result.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('BuildResult', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get_build_result.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/builds/{buildName}/results/{buildResultName}'} # type: ignore + + + @distributed_trace + def get_build_result_log( + self, + resource_group_name: str, + service_name: str, + build_service_name: str, + build_name: str, + build_result_name: str, + **kwargs: Any + ) -> "_models.BuildResultLog": + """Get a KPack build result log download 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 build_service_name: The name of the build service resource. + :type build_service_name: str + :param build_name: The name of the build resource. + :type build_name: str + :param build_result_name: The name of the build result resource. + :type build_result_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: BuildResultLog, or the result of cls(response) + :rtype: ~azure.mgmt.appplatform.v2022_01_01_preview.models.BuildResultLog + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.BuildResultLog"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_get_build_result_log_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + build_service_name=build_service_name, + build_name=build_name, + build_result_name=build_result_name, + template_url=self.get_build_result_log.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('BuildResultLog', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get_build_result_log.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/builds/{buildName}/results/{buildResultName}/getLogFileUrl'} # type: ignore + + + @distributed_trace + def get_resource_upload_url( + self, + resource_group_name: str, + service_name: str, + build_service_name: str, + **kwargs: Any + ) -> "_models.ResourceUploadDefinition": + """Get an resource upload URL for build service, 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 build_service_name: The name of the build service resource. + :type build_service_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.v2022_01_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, + build_service_name=build_service_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}/buildServices/{buildServiceName}/getResourceUploadUrl'} # type: ignore + + + @distributed_trace + def list_supported_buildpacks( + self, + resource_group_name: str, + service_name: str, + build_service_name: str, + **kwargs: Any + ) -> "_models.SupportedBuildpacksCollection": + """Get all supported buildpacks. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. + :type resource_group_name: str + :param service_name: The name of the Service resource. + :type service_name: str + :param build_service_name: The name of the build service resource. + :type build_service_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SupportedBuildpacksCollection, or the result of cls(response) + :rtype: ~azure.mgmt.appplatform.v2022_01_01_preview.models.SupportedBuildpacksCollection + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.SupportedBuildpacksCollection"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_list_supported_buildpacks_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + build_service_name=build_service_name, + template_url=self.list_supported_buildpacks.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('SupportedBuildpacksCollection', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + list_supported_buildpacks.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/supportedBuildpacks'} # type: ignore + + + @distributed_trace + def get_supported_buildpack( + self, + resource_group_name: str, + service_name: str, + build_service_name: str, + buildpack_name: str, + **kwargs: Any + ) -> "_models.SupportedBuildpackResource": + """Get the supported buildpack 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 build_service_name: The name of the build service resource. + :type build_service_name: str + :param buildpack_name: The name of the buildpack resource. + :type buildpack_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SupportedBuildpackResource, or the result of cls(response) + :rtype: ~azure.mgmt.appplatform.v2022_01_01_preview.models.SupportedBuildpackResource + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.SupportedBuildpackResource"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_get_supported_buildpack_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + build_service_name=build_service_name, + buildpack_name=buildpack_name, + template_url=self.get_supported_buildpack.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('SupportedBuildpackResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get_supported_buildpack.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/supportedBuildpacks/{buildpackName}'} # type: ignore + + + @distributed_trace + def list_supported_stacks( + self, + resource_group_name: str, + service_name: str, + build_service_name: str, + **kwargs: Any + ) -> "_models.SupportedStacksCollection": + """Get all supported stacks. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. + :type resource_group_name: str + :param service_name: The name of the Service resource. + :type service_name: str + :param build_service_name: The name of the build service resource. + :type build_service_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SupportedStacksCollection, or the result of cls(response) + :rtype: ~azure.mgmt.appplatform.v2022_01_01_preview.models.SupportedStacksCollection + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.SupportedStacksCollection"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_list_supported_stacks_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + build_service_name=build_service_name, + template_url=self.list_supported_stacks.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('SupportedStacksCollection', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + list_supported_stacks.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/supportedStacks'} # type: ignore + + + @distributed_trace + def get_supported_stack( + self, + resource_group_name: str, + service_name: str, + build_service_name: str, + stack_name: str, + **kwargs: Any + ) -> "_models.SupportedStackResource": + """Get the supported stack 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 build_service_name: The name of the build service resource. + :type build_service_name: str + :param stack_name: The name of the stack resource. + :type stack_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SupportedStackResource, or the result of cls(response) + :rtype: ~azure.mgmt.appplatform.v2022_01_01_preview.models.SupportedStackResource + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.SupportedStackResource"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_get_supported_stack_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + build_service_name=build_service_name, + stack_name=stack_name, + template_url=self.get_supported_stack.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('SupportedStackResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get_supported_stack.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/supportedStacks/{stackName}'} # type: ignore + diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_01_01_preview/operations/_buildpack_binding_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_01_01_preview/operations/_buildpack_binding_operations.py new file mode 100644 index 000000000000..095910a0d550 --- /dev/null +++ b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_01_01_preview/operations/_buildpack_binding_operations.py @@ -0,0 +1,628 @@ +# 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, Iterable, Optional, TypeVar, Union +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 +T = TypeVar('T') +JSONType = Any +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_get_request( + subscription_id: str, + resource_group_name: str, + service_name: str, + build_service_name: str, + builder_name: str, + buildpack_binding_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2022-01-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/builders/{builderName}/buildpackBindings/{buildpackBindingName}') + 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'), + "buildServiceName": _SERIALIZER.url("build_service_name", build_service_name, 'str'), + "builderName": _SERIALIZER.url("builder_name", builder_name, 'str'), + "buildpackBindingName": _SERIALIZER.url("buildpack_binding_name", buildpack_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: str, + resource_group_name: str, + service_name: str, + build_service_name: str, + builder_name: str, + buildpack_binding_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2022-01-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/builders/{builderName}/buildpackBindings/{buildpackBindingName}') + 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'), + "buildServiceName": _SERIALIZER.url("build_service_name", build_service_name, 'str'), + "builderName": _SERIALIZER.url("builder_name", builder_name, 'str'), + "buildpackBindingName": _SERIALIZER.url("buildpack_binding_name", buildpack_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, + json=json, + content=content, + **kwargs + ) + + +def build_delete_request_initial( + subscription_id: str, + resource_group_name: str, + service_name: str, + build_service_name: str, + builder_name: str, + buildpack_binding_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2022-01-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/builders/{builderName}/buildpackBindings/{buildpackBindingName}') + 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'), + "buildServiceName": _SERIALIZER.url("build_service_name", build_service_name, 'str'), + "builderName": _SERIALIZER.url("builder_name", builder_name, 'str'), + "buildpackBindingName": _SERIALIZER.url("buildpack_binding_name", buildpack_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_list_request( + subscription_id: str, + resource_group_name: str, + service_name: str, + build_service_name: str, + builder_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2022-01-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/builders/{builderName}/buildpackBindings') + 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'), + "buildServiceName": _SERIALIZER.url("build_service_name", build_service_name, 'str'), + "builderName": _SERIALIZER.url("builder_name", builder_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 + ) + +class BuildpackBindingOperations(object): + """BuildpackBindingOperations 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.v2022_01_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: str, + service_name: str, + build_service_name: str, + builder_name: str, + buildpack_binding_name: str, + **kwargs: Any + ) -> "_models.BuildpackBindingResource": + """Get a buildpack binding by name. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. + :type resource_group_name: str + :param service_name: The name of the Service resource. + :type service_name: str + :param build_service_name: The name of the build service resource. + :type build_service_name: str + :param builder_name: The name of the builder resource. + :type builder_name: str + :param buildpack_binding_name: The name of the Buildpack Binding Name. + :type buildpack_binding_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: BuildpackBindingResource, or the result of cls(response) + :rtype: ~azure.mgmt.appplatform.v2022_01_01_preview.models.BuildpackBindingResource + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.BuildpackBindingResource"] + 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, + build_service_name=build_service_name, + builder_name=builder_name, + buildpack_binding_name=buildpack_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('BuildpackBindingResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/builders/{builderName}/buildpackBindings/{buildpackBindingName}'} # type: ignore + + + def _create_or_update_initial( + self, + resource_group_name: str, + service_name: str, + build_service_name: str, + builder_name: str, + buildpack_binding_name: str, + buildpack_binding: "_models.BuildpackBindingResource", + **kwargs: Any + ) -> "_models.BuildpackBindingResource": + cls = kwargs.pop('cls', None) # type: ClsType["_models.BuildpackBindingResource"] + 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(buildpack_binding, 'BuildpackBindingResource') + + request = build_create_or_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + build_service_name=build_service_name, + builder_name=builder_name, + buildpack_binding_name=buildpack_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]: + 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('BuildpackBindingResource', pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize('BuildpackBindingResource', 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}/buildServices/{buildServiceName}/builders/{builderName}/buildpackBindings/{buildpackBindingName}'} # type: ignore + + + @distributed_trace + def begin_create_or_update( + self, + resource_group_name: str, + service_name: str, + build_service_name: str, + builder_name: str, + buildpack_binding_name: str, + buildpack_binding: "_models.BuildpackBindingResource", + **kwargs: Any + ) -> LROPoller["_models.BuildpackBindingResource"]: + """Create or update a buildpack 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 build_service_name: The name of the build service resource. + :type build_service_name: str + :param builder_name: The name of the builder resource. + :type builder_name: str + :param buildpack_binding_name: The name of the Buildpack Binding Name. + :type buildpack_binding_name: str + :param buildpack_binding: The target buildpack binding for the create or update operation. + :type buildpack_binding: + ~azure.mgmt.appplatform.v2022_01_01_preview.models.BuildpackBindingResource + :keyword callable cls: A custom type or function that will be passed the direct response + :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 BuildpackBindingResource or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2022_01_01_preview.models.BuildpackBindingResource] + :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.BuildpackBindingResource"] + 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, + build_service_name=build_service_name, + builder_name=builder_name, + buildpack_binding_name=buildpack_binding_name, + buildpack_binding=buildpack_binding, + 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('BuildpackBindingResource', 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}/buildServices/{buildServiceName}/builders/{builderName}/buildpackBindings/{buildpackBindingName}'} # type: ignore + + def _delete_initial( + self, + resource_group_name: str, + service_name: str, + build_service_name: str, + builder_name: str, + buildpack_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, + build_service_name=build_service_name, + builder_name=builder_name, + buildpack_binding_name=buildpack_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}/buildServices/{buildServiceName}/builders/{builderName}/buildpackBindings/{buildpackBindingName}'} # type: ignore + + + @distributed_trace + def begin_delete( + self, + resource_group_name: str, + service_name: str, + build_service_name: str, + builder_name: str, + buildpack_binding_name: str, + **kwargs: Any + ) -> LROPoller[None]: + """Operation to delete a Buildpack 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 build_service_name: The name of the build service resource. + :type build_service_name: str + :param builder_name: The name of the builder resource. + :type builder_name: str + :param buildpack_binding_name: The name of the Buildpack Binding Name. + :type buildpack_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, + build_service_name=build_service_name, + builder_name=builder_name, + buildpack_binding_name=buildpack_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}/buildServices/{buildServiceName}/builders/{builderName}/buildpackBindings/{buildpackBindingName}'} # type: ignore + + @distributed_trace + def list( + self, + resource_group_name: str, + service_name: str, + build_service_name: str, + builder_name: str, + **kwargs: Any + ) -> Iterable["_models.BuildpackBindingResourceCollection"]: + """Handles requests to list all buildpack bindings in a builder. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. + :type resource_group_name: str + :param service_name: The name of the Service resource. + :type service_name: str + :param build_service_name: The name of the build service resource. + :type build_service_name: str + :param builder_name: The name of the builder resource. + :type builder_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either BuildpackBindingResourceCollection or the result + of cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2022_01_01_preview.models.BuildpackBindingResourceCollection] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.BuildpackBindingResourceCollection"] + 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, + build_service_name=build_service_name, + builder_name=builder_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, + build_service_name=build_service_name, + builder_name=builder_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("BuildpackBindingResourceCollection", 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}/buildServices/{buildServiceName}/builders/{builderName}/buildpackBindings'} # type: ignore diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_01_01_preview/operations/_certificates_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_01_01_preview/operations/_certificates_operations.py new file mode 100644 index 000000000000..66af6c1d5731 --- /dev/null +++ b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_01_01_preview/operations/_certificates_operations.py @@ -0,0 +1,573 @@ +# 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, Iterable, Optional, TypeVar, Union +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 +T = TypeVar('T') +JSONType = Any +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_get_request( + subscription_id: str, + resource_group_name: str, + service_name: str, + certificate_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2022-01-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: str, + resource_group_name: str, + service_name: str, + certificate_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2022-01-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, + json=json, + content=content, + **kwargs + ) + + +def build_delete_request_initial( + subscription_id: str, + resource_group_name: str, + service_name: str, + certificate_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2022-01-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: str, + resource_group_name: str, + service_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2022-01-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 + ) + +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.v2022_01_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: 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.v2022_01_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: 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 = 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: str, + service_name: str, + certificate_name: str, + certificate_resource: "_models.CertificateResource", + **kwargs: Any + ) -> 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.v2022_01_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.v2022_01_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: 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 = 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: str, + service_name: str, + certificate_name: str, + **kwargs: Any + ) -> 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: str, + service_name: str, + **kwargs: Any + ) -> 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.v2022_01_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/v2022_01_01_preview/operations/_config_servers_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_01_01_preview/operations/_config_servers_operations.py new file mode 100644 index 000000000000..73221b15b2a4 --- /dev/null +++ b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_01_01_preview/operations/_config_servers_operations.py @@ -0,0 +1,638 @@ +# 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 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 +T = TypeVar('T') +JSONType = Any +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_get_request( + subscription_id: str, + resource_group_name: str, + service_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2022-01-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: str, + resource_group_name: str, + service_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2022-01-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, + json=json, + content=content, + **kwargs + ) + + +def build_update_patch_request_initial( + subscription_id: str, + resource_group_name: str, + service_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2022-01-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, + json=json, + content=content, + **kwargs + ) + + +def build_validate_request_initial( + subscription_id: str, + resource_group_name: str, + service_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2022-01-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, + json=json, + content=content, + **kwargs + ) + +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.v2022_01_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: 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.v2022_01_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: 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 = 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: str, + service_name: str, + config_server_resource: "_models.ConfigServerResource", + **kwargs: Any + ) -> 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.v2022_01_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.v2022_01_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: 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 = 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: str, + service_name: str, + config_server_resource: "_models.ConfigServerResource", + **kwargs: Any + ) -> 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.v2022_01_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.v2022_01_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: 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 = 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: str, + service_name: str, + config_server_settings: "_models.ConfigServerSettings", + **kwargs: Any + ) -> 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.v2022_01_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.v2022_01_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/v2022_01_01_preview/operations/_configuration_services_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_01_01_preview/operations/_configuration_services_operations.py new file mode 100644 index 000000000000..f013b2a21c1f --- /dev/null +++ b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_01_01_preview/operations/_configuration_services_operations.py @@ -0,0 +1,745 @@ +# 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, Iterable, Optional, TypeVar, Union +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 +T = TypeVar('T') +JSONType = Any +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_get_request( + subscription_id: str, + resource_group_name: str, + service_name: str, + configuration_service_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2022-01-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configurationServices/{configurationServiceName}') + 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'), + "configurationServiceName": _SERIALIZER.url("configuration_service_name", configuration_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: str, + resource_group_name: str, + service_name: str, + configuration_service_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2022-01-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configurationServices/{configurationServiceName}') + 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'), + "configurationServiceName": _SERIALIZER.url("configuration_service_name", configuration_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, + json=json, + content=content, + **kwargs + ) + + +def build_delete_request_initial( + subscription_id: str, + resource_group_name: str, + service_name: str, + configuration_service_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2022-01-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configurationServices/{configurationServiceName}') + 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'), + "configurationServiceName": _SERIALIZER.url("configuration_service_name", configuration_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_list_request( + subscription_id: str, + resource_group_name: str, + service_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2022-01-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configurationServices') + 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_validate_request_initial( + subscription_id: str, + resource_group_name: str, + service_name: str, + configuration_service_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2022-01-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configurationServices/{configurationServiceName}/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'), + "configurationServiceName": _SERIALIZER.url("configuration_service_name", configuration_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, + json=json, + content=content, + **kwargs + ) + +class ConfigurationServicesOperations(object): + """ConfigurationServicesOperations 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.v2022_01_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: str, + service_name: str, + configuration_service_name: str, + **kwargs: Any + ) -> "_models.ConfigurationServiceResource": + """Get the Application Configuration 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 + :param configuration_service_name: The name of Application Configuration Service. + :type configuration_service_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ConfigurationServiceResource, or the result of cls(response) + :rtype: ~azure.mgmt.appplatform.v2022_01_01_preview.models.ConfigurationServiceResource + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.ConfigurationServiceResource"] + 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, + configuration_service_name=configuration_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('ConfigurationServiceResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configurationServices/{configurationServiceName}'} # type: ignore + + + def _create_or_update_initial( + self, + resource_group_name: str, + service_name: str, + configuration_service_name: str, + configuration_service_resource: "_models.ConfigurationServiceResource", + **kwargs: Any + ) -> "_models.ConfigurationServiceResource": + cls = kwargs.pop('cls', None) # type: ClsType["_models.ConfigurationServiceResource"] + 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(configuration_service_resource, 'ConfigurationServiceResource') + + request = build_create_or_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + configuration_service_name=configuration_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]: + 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('ConfigurationServiceResource', pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize('ConfigurationServiceResource', 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}/configurationServices/{configurationServiceName}'} # type: ignore + + + @distributed_trace + def begin_create_or_update( + self, + resource_group_name: str, + service_name: str, + configuration_service_name: str, + configuration_service_resource: "_models.ConfigurationServiceResource", + **kwargs: Any + ) -> LROPoller["_models.ConfigurationServiceResource"]: + """Create the default Application Configuration Service or update the existing Application + Configuration 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 configuration_service_name: The name of Application Configuration Service. + :type configuration_service_name: str + :param configuration_service_resource: Parameters for the update operation. + :type configuration_service_resource: + ~azure.mgmt.appplatform.v2022_01_01_preview.models.ConfigurationServiceResource + :keyword callable cls: A custom type or function that will be passed the direct response + :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 ConfigurationServiceResource or the + result of cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2022_01_01_preview.models.ConfigurationServiceResource] + :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.ConfigurationServiceResource"] + 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, + configuration_service_name=configuration_service_name, + configuration_service_resource=configuration_service_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('ConfigurationServiceResource', 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}/configurationServices/{configurationServiceName}'} # type: ignore + + def _delete_initial( + self, + resource_group_name: str, + service_name: str, + configuration_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, + configuration_service_name=configuration_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 [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}/configurationServices/{configurationServiceName}'} # type: ignore + + + @distributed_trace + def begin_delete( + self, + resource_group_name: str, + service_name: str, + configuration_service_name: str, + **kwargs: Any + ) -> LROPoller[None]: + """Disable the default Application Configuration 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 configuration_service_name: The name of Application Configuration Service. + :type configuration_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, + configuration_service_name=configuration_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}/configurationServices/{configurationServiceName}'} # type: ignore + + @distributed_trace + def list( + self, + resource_group_name: str, + service_name: str, + **kwargs: Any + ) -> Iterable["_models.ConfigurationServiceResourceCollection"]: + """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 ConfigurationServiceResourceCollection or the + result of cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2022_01_01_preview.models.ConfigurationServiceResourceCollection] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.ConfigurationServiceResourceCollection"] + 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("ConfigurationServiceResourceCollection", 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}/configurationServices'} # type: ignore + + def _validate_initial( + self, + resource_group_name: str, + service_name: str, + configuration_service_name: str, + settings: "_models.ConfigurationServiceSettings", + **kwargs: Any + ) -> "_models.ConfigurationServiceSettingsValidateResult": + cls = kwargs.pop('cls', None) # type: ClsType["_models.ConfigurationServiceSettingsValidateResult"] + 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(settings, 'ConfigurationServiceSettings') + + request = build_validate_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + configuration_service_name=configuration_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('ConfigurationServiceSettingsValidateResult', pipeline_response) + + if response.status_code == 202: + deserialized = self._deserialize('ConfigurationServiceSettingsValidateResult', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + _validate_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configurationServices/{configurationServiceName}/validate'} # type: ignore + + + @distributed_trace + def begin_validate( + self, + resource_group_name: str, + service_name: str, + configuration_service_name: str, + settings: "_models.ConfigurationServiceSettings", + **kwargs: Any + ) -> LROPoller["_models.ConfigurationServiceSettingsValidateResult"]: + """Check if the Application Configuration Service 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 configuration_service_name: The name of Application Configuration Service. + :type configuration_service_name: str + :param settings: Application Configuration Service settings to be validated. + :type settings: ~azure.mgmt.appplatform.v2022_01_01_preview.models.ConfigurationServiceSettings + :keyword callable cls: A custom type or function that will be passed the direct response + :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 + ConfigurationServiceSettingsValidateResult or the result of cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2022_01_01_preview.models.ConfigurationServiceSettingsValidateResult] + :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.ConfigurationServiceSettingsValidateResult"] + 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, + configuration_service_name=configuration_service_name, + settings=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('ConfigurationServiceSettingsValidateResult', 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}/configurationServices/{configurationServiceName}/validate'} # type: ignore diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_01_01_preview/operations/_custom_domains_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_01_01_preview/operations/_custom_domains_operations.py new file mode 100644 index 000000000000..f8dd95f27a54 --- /dev/null +++ b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_01_01_preview/operations/_custom_domains_operations.py @@ -0,0 +1,783 @@ +# 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, Iterable, Optional, TypeVar, Union +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 +T = TypeVar('T') +JSONType = Any +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_get_request( + subscription_id: str, + resource_group_name: str, + service_name: str, + app_name: str, + domain_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2022-01-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: str, + resource_group_name: str, + service_name: str, + app_name: str, + domain_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2022-01-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, + json=json, + content=content, + **kwargs + ) + + +def build_delete_request_initial( + subscription_id: str, + resource_group_name: str, + service_name: str, + app_name: str, + domain_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2022-01-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: str, + resource_group_name: str, + service_name: str, + app_name: str, + domain_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2022-01-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, + json=json, + content=content, + **kwargs + ) + + +def build_list_request( + subscription_id: str, + resource_group_name: str, + service_name: str, + app_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2022-01-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 + ) + +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.v2022_01_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: 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.v2022_01_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: 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 = 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: str, + service_name: str, + app_name: str, + domain_name: str, + domain_resource: "_models.CustomDomainResource", + **kwargs: Any + ) -> 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.v2022_01_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.v2022_01_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: 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 = 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: str, + service_name: str, + app_name: str, + domain_name: str, + **kwargs: Any + ) -> 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: 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 = 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: str, + service_name: str, + app_name: str, + domain_name: str, + domain_resource: "_models.CustomDomainResource", + **kwargs: Any + ) -> 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.v2022_01_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.v2022_01_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: str, + service_name: str, + app_name: str, + **kwargs: Any + ) -> 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.v2022_01_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/v2022_01_01_preview/operations/_deployments_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_01_01_preview/operations/_deployments_operations.py new file mode 100644 index 000000000000..fc4b1aa57957 --- /dev/null +++ b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_01_01_preview/operations/_deployments_operations.py @@ -0,0 +1,1969 @@ +# 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, Iterable, List, Optional, TypeVar, Union +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 +T = TypeVar('T') +JSONType = Any +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_get_request( + subscription_id: str, + resource_group_name: str, + service_name: str, + app_name: str, + deployment_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2022-01-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: str, + resource_group_name: str, + service_name: str, + app_name: str, + deployment_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2022-01-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, + json=json, + content=content, + **kwargs + ) + + +def build_delete_request_initial( + subscription_id: str, + resource_group_name: str, + service_name: str, + app_name: str, + deployment_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2022-01-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: str, + resource_group_name: str, + service_name: str, + app_name: str, + deployment_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2022-01-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, + json=json, + content=content, + **kwargs + ) + + +def build_list_request( + subscription_id: str, + resource_group_name: str, + service_name: str, + app_name: str, + *, + version: Optional[List[str]] = None, + **kwargs: Any +) -> HttpRequest: + api_version = "2022-01-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: str, + resource_group_name: str, + service_name: str, + *, + version: Optional[List[str]] = None, + **kwargs: Any +) -> HttpRequest: + api_version = "2022-01-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: str, + resource_group_name: str, + service_name: str, + app_name: str, + deployment_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2022-01-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: str, + resource_group_name: str, + service_name: str, + app_name: str, + deployment_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2022-01-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: str, + resource_group_name: str, + service_name: str, + app_name: str, + deployment_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2022-01-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: str, + resource_group_name: str, + service_name: str, + app_name: str, + deployment_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2022-01-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: str, + resource_group_name: str, + service_name: str, + app_name: str, + deployment_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2022-01-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, + json=json, + content=content, + **kwargs + ) + + +def build_generate_thread_dump_request_initial( + subscription_id: str, + resource_group_name: str, + service_name: str, + app_name: str, + deployment_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2022-01-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, + json=json, + content=content, + **kwargs + ) + + +def build_start_jfr_request_initial( + subscription_id: str, + resource_group_name: str, + service_name: str, + app_name: str, + deployment_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2022-01-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, + json=json, + content=content, + **kwargs + ) + +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.v2022_01_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: 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.v2022_01_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: 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 = 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: str, + service_name: str, + app_name: str, + deployment_name: str, + deployment_resource: "_models.DeploymentResource", + **kwargs: Any + ) -> 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.v2022_01_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.v2022_01_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: 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 = 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: str, + service_name: str, + app_name: str, + deployment_name: str, + **kwargs: Any + ) -> 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: 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 = 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: str, + service_name: str, + app_name: str, + deployment_name: str, + deployment_resource: "_models.DeploymentResource", + **kwargs: Any + ) -> 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.v2022_01_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.v2022_01_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: str, + service_name: str, + app_name: str, + version: Optional[List[str]] = None, + **kwargs: Any + ) -> 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.v2022_01_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: str, + service_name: str, + version: Optional[List[str]] = None, + **kwargs: Any + ) -> 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.v2022_01_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: 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 = 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: str, + service_name: str, + app_name: str, + deployment_name: str, + **kwargs: Any + ) -> 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: 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 = 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: str, + service_name: str, + app_name: str, + deployment_name: str, + **kwargs: Any + ) -> 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: 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 = 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: str, + service_name: str, + app_name: str, + deployment_name: str, + **kwargs: Any + ) -> 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: 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.v2022_01_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: 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 = 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: str, + service_name: str, + app_name: str, + deployment_name: str, + diagnostic_parameters: "_models.DiagnosticParameters", + **kwargs: Any + ) -> 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.v2022_01_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: 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 = 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: str, + service_name: str, + app_name: str, + deployment_name: str, + diagnostic_parameters: "_models.DiagnosticParameters", + **kwargs: Any + ) -> 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.v2022_01_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: 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 = 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: str, + service_name: str, + app_name: str, + deployment_name: str, + diagnostic_parameters: "_models.DiagnosticParameters", + **kwargs: Any + ) -> 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.v2022_01_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/v2022_01_01_preview/operations/_gateway_custom_domains_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_01_01_preview/operations/_gateway_custom_domains_operations.py new file mode 100644 index 000000000000..e840788ecf51 --- /dev/null +++ b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_01_01_preview/operations/_gateway_custom_domains_operations.py @@ -0,0 +1,600 @@ +# 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, Iterable, Optional, TypeVar, Union +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 +T = TypeVar('T') +JSONType = Any +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_get_request( + subscription_id: str, + resource_group_name: str, + service_name: str, + gateway_name: str, + domain_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2022-01-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/gateways/{gatewayName}/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'), + "gatewayName": _SERIALIZER.url("gateway_name", gateway_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: str, + resource_group_name: str, + service_name: str, + gateway_name: str, + domain_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2022-01-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/gateways/{gatewayName}/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'), + "gatewayName": _SERIALIZER.url("gateway_name", gateway_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, + json=json, + content=content, + **kwargs + ) + + +def build_delete_request_initial( + subscription_id: str, + resource_group_name: str, + service_name: str, + gateway_name: str, + domain_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2022-01-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/gateways/{gatewayName}/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'), + "gatewayName": _SERIALIZER.url("gateway_name", gateway_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_list_request( + subscription_id: str, + resource_group_name: str, + service_name: str, + gateway_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2022-01-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/gateways/{gatewayName}/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'), + "gatewayName": _SERIALIZER.url("gateway_name", gateway_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 + ) + +class GatewayCustomDomainsOperations(object): + """GatewayCustomDomainsOperations 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.v2022_01_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: str, + service_name: str, + gateway_name: str, + domain_name: str, + **kwargs: Any + ) -> "_models.GatewayCustomDomainResource": + """Get the Spring Cloud Gateway custom domain. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. + :type resource_group_name: str + :param service_name: The name of the Service resource. + :type service_name: str + :param gateway_name: The name of Spring Cloud Gateway. + :type gateway_name: str + :param domain_name: The name of the Spring Cloud Gateway custom domain. + :type domain_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: GatewayCustomDomainResource, or the result of cls(response) + :rtype: ~azure.mgmt.appplatform.v2022_01_01_preview.models.GatewayCustomDomainResource + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.GatewayCustomDomainResource"] + 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, + gateway_name=gateway_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('GatewayCustomDomainResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/gateways/{gatewayName}/domains/{domainName}'} # type: ignore + + + def _create_or_update_initial( + self, + resource_group_name: str, + service_name: str, + gateway_name: str, + domain_name: str, + gateway_custom_domain_resource: "_models.GatewayCustomDomainResource", + **kwargs: Any + ) -> "_models.GatewayCustomDomainResource": + cls = kwargs.pop('cls', None) # type: ClsType["_models.GatewayCustomDomainResource"] + 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(gateway_custom_domain_resource, 'GatewayCustomDomainResource') + + request = build_create_or_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + gateway_name=gateway_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]: + 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('GatewayCustomDomainResource', pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize('GatewayCustomDomainResource', 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}/gateways/{gatewayName}/domains/{domainName}'} # type: ignore + + + @distributed_trace + def begin_create_or_update( + self, + resource_group_name: str, + service_name: str, + gateway_name: str, + domain_name: str, + gateway_custom_domain_resource: "_models.GatewayCustomDomainResource", + **kwargs: Any + ) -> LROPoller["_models.GatewayCustomDomainResource"]: + """Create or update the Spring Cloud Gateway custom domain. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. + :type resource_group_name: str + :param service_name: The name of the Service resource. + :type service_name: str + :param gateway_name: The name of Spring Cloud Gateway. + :type gateway_name: str + :param domain_name: The name of the Spring Cloud Gateway custom domain. + :type domain_name: str + :param gateway_custom_domain_resource: The gateway custom domain resource for the create or + update operation. + :type gateway_custom_domain_resource: + ~azure.mgmt.appplatform.v2022_01_01_preview.models.GatewayCustomDomainResource + :keyword callable cls: A custom type or function that will be passed the direct response + :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 GatewayCustomDomainResource or the result + of cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2022_01_01_preview.models.GatewayCustomDomainResource] + :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.GatewayCustomDomainResource"] + 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, + gateway_name=gateway_name, + domain_name=domain_name, + gateway_custom_domain_resource=gateway_custom_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('GatewayCustomDomainResource', 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}/gateways/{gatewayName}/domains/{domainName}'} # type: ignore + + def _delete_initial( + self, + resource_group_name: str, + service_name: str, + gateway_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, + gateway_name=gateway_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}/gateways/{gatewayName}/domains/{domainName}'} # type: ignore + + + @distributed_trace + def begin_delete( + self, + resource_group_name: str, + service_name: str, + gateway_name: str, + domain_name: str, + **kwargs: Any + ) -> LROPoller[None]: + """Delete the Spring Cloud Gateway custom domain. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. + :type resource_group_name: str + :param service_name: The name of the Service resource. + :type service_name: str + :param gateway_name: The name of Spring Cloud Gateway. + :type gateway_name: str + :param domain_name: The name of the Spring Cloud Gateway custom domain. + :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, + gateway_name=gateway_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}/gateways/{gatewayName}/domains/{domainName}'} # type: ignore + + @distributed_trace + def list( + self, + resource_group_name: str, + service_name: str, + gateway_name: str, + **kwargs: Any + ) -> Iterable["_models.GatewayCustomDomainResourceCollection"]: + """Handle requests to list all Spring Cloud Gateway custom domains. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. + :type resource_group_name: str + :param service_name: The name of the Service resource. + :type service_name: str + :param gateway_name: The name of Spring Cloud Gateway. + :type gateway_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either GatewayCustomDomainResourceCollection or the + result of cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2022_01_01_preview.models.GatewayCustomDomainResourceCollection] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.GatewayCustomDomainResourceCollection"] + 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, + gateway_name=gateway_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, + gateway_name=gateway_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("GatewayCustomDomainResourceCollection", 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}/gateways/{gatewayName}/domains'} # type: ignore diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_01_01_preview/operations/_gateway_route_configs_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_01_01_preview/operations/_gateway_route_configs_operations.py new file mode 100644 index 000000000000..a2bdd036c6de --- /dev/null +++ b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_01_01_preview/operations/_gateway_route_configs_operations.py @@ -0,0 +1,601 @@ +# 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, Iterable, Optional, TypeVar, Union +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 +T = TypeVar('T') +JSONType = Any +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_get_request( + subscription_id: str, + resource_group_name: str, + service_name: str, + gateway_name: str, + route_config_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2022-01-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/gateways/{gatewayName}/routeConfigs/{routeConfigName}') + 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'), + "gatewayName": _SERIALIZER.url("gateway_name", gateway_name, 'str'), + "routeConfigName": _SERIALIZER.url("route_config_name", route_config_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: str, + resource_group_name: str, + service_name: str, + gateway_name: str, + route_config_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2022-01-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/gateways/{gatewayName}/routeConfigs/{routeConfigName}') + 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'), + "gatewayName": _SERIALIZER.url("gateway_name", gateway_name, 'str'), + "routeConfigName": _SERIALIZER.url("route_config_name", route_config_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, + json=json, + content=content, + **kwargs + ) + + +def build_delete_request_initial( + subscription_id: str, + resource_group_name: str, + service_name: str, + gateway_name: str, + route_config_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2022-01-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/gateways/{gatewayName}/routeConfigs/{routeConfigName}') + 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'), + "gatewayName": _SERIALIZER.url("gateway_name", gateway_name, 'str'), + "routeConfigName": _SERIALIZER.url("route_config_name", route_config_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: str, + resource_group_name: str, + service_name: str, + gateway_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2022-01-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/gateways/{gatewayName}/routeConfigs') + 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'), + "gatewayName": _SERIALIZER.url("gateway_name", gateway_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 + ) + +class GatewayRouteConfigsOperations(object): + """GatewayRouteConfigsOperations 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.v2022_01_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: str, + service_name: str, + gateway_name: str, + route_config_name: str, + **kwargs: Any + ) -> "_models.GatewayRouteConfigResource": + """Get the Spring Cloud Gateway route configs. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. + :type resource_group_name: str + :param service_name: The name of the Service resource. + :type service_name: str + :param gateway_name: The name of Spring Cloud Gateway. + :type gateway_name: str + :param route_config_name: The name of the Spring Cloud Gateway route config. + :type route_config_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: GatewayRouteConfigResource, or the result of cls(response) + :rtype: ~azure.mgmt.appplatform.v2022_01_01_preview.models.GatewayRouteConfigResource + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.GatewayRouteConfigResource"] + 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, + gateway_name=gateway_name, + route_config_name=route_config_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('GatewayRouteConfigResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/gateways/{gatewayName}/routeConfigs/{routeConfigName}'} # type: ignore + + + def _create_or_update_initial( + self, + resource_group_name: str, + service_name: str, + gateway_name: str, + route_config_name: str, + gateway_route_config_resource: "_models.GatewayRouteConfigResource", + **kwargs: Any + ) -> "_models.GatewayRouteConfigResource": + cls = kwargs.pop('cls', None) # type: ClsType["_models.GatewayRouteConfigResource"] + 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(gateway_route_config_resource, 'GatewayRouteConfigResource') + + request = build_create_or_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + gateway_name=gateway_name, + route_config_name=route_config_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]: + 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('GatewayRouteConfigResource', pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize('GatewayRouteConfigResource', 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}/gateways/{gatewayName}/routeConfigs/{routeConfigName}'} # type: ignore + + + @distributed_trace + def begin_create_or_update( + self, + resource_group_name: str, + service_name: str, + gateway_name: str, + route_config_name: str, + gateway_route_config_resource: "_models.GatewayRouteConfigResource", + **kwargs: Any + ) -> LROPoller["_models.GatewayRouteConfigResource"]: + """Create the default Spring Cloud Gateway route configs or update the existing Spring Cloud + Gateway route configs. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. + :type resource_group_name: str + :param service_name: The name of the Service resource. + :type service_name: str + :param gateway_name: The name of Spring Cloud Gateway. + :type gateway_name: str + :param route_config_name: The name of the Spring Cloud Gateway route config. + :type route_config_name: str + :param gateway_route_config_resource: The Spring Cloud Gateway route config for the create or + update operation. + :type gateway_route_config_resource: + ~azure.mgmt.appplatform.v2022_01_01_preview.models.GatewayRouteConfigResource + :keyword callable cls: A custom type or function that will be passed the direct response + :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 GatewayRouteConfigResource or the result + of cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2022_01_01_preview.models.GatewayRouteConfigResource] + :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.GatewayRouteConfigResource"] + 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, + gateway_name=gateway_name, + route_config_name=route_config_name, + gateway_route_config_resource=gateway_route_config_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('GatewayRouteConfigResource', 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}/gateways/{gatewayName}/routeConfigs/{routeConfigName}'} # type: ignore + + def _delete_initial( + self, + resource_group_name: str, + service_name: str, + gateway_name: str, + route_config_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, + gateway_name=gateway_name, + route_config_name=route_config_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}/gateways/{gatewayName}/routeConfigs/{routeConfigName}'} # type: ignore + + + @distributed_trace + def begin_delete( + self, + resource_group_name: str, + service_name: str, + gateway_name: str, + route_config_name: str, + **kwargs: Any + ) -> LROPoller[None]: + """Delete the Spring Cloud Gateway route config. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. + :type resource_group_name: str + :param service_name: The name of the Service resource. + :type service_name: str + :param gateway_name: The name of Spring Cloud Gateway. + :type gateway_name: str + :param route_config_name: The name of the Spring Cloud Gateway route config. + :type route_config_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, + gateway_name=gateway_name, + route_config_name=route_config_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}/gateways/{gatewayName}/routeConfigs/{routeConfigName}'} # type: ignore + + @distributed_trace + def list( + self, + resource_group_name: str, + service_name: str, + gateway_name: str, + **kwargs: Any + ) -> Iterable["_models.GatewayRouteConfigResourceCollection"]: + """Handle requests to list all Spring Cloud Gateway route configs. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. + :type resource_group_name: str + :param service_name: The name of the Service resource. + :type service_name: str + :param gateway_name: The name of Spring Cloud Gateway. + :type gateway_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either GatewayRouteConfigResourceCollection or the result + of cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2022_01_01_preview.models.GatewayRouteConfigResourceCollection] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.GatewayRouteConfigResourceCollection"] + 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, + gateway_name=gateway_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, + gateway_name=gateway_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("GatewayRouteConfigResourceCollection", 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}/gateways/{gatewayName}/routeConfigs'} # type: ignore diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_01_01_preview/operations/_gateways_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_01_01_preview/operations/_gateways_operations.py new file mode 100644 index 000000000000..bc006990dd80 --- /dev/null +++ b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_01_01_preview/operations/_gateways_operations.py @@ -0,0 +1,680 @@ +# 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, Iterable, Optional, TypeVar, Union +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 +T = TypeVar('T') +JSONType = Any +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_get_request( + subscription_id: str, + resource_group_name: str, + service_name: str, + gateway_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2022-01-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/gateways/{gatewayName}') + 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'), + "gatewayName": _SERIALIZER.url("gateway_name", gateway_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: str, + resource_group_name: str, + service_name: str, + gateway_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2022-01-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/gateways/{gatewayName}') + 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'), + "gatewayName": _SERIALIZER.url("gateway_name", gateway_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, + json=json, + content=content, + **kwargs + ) + + +def build_delete_request_initial( + subscription_id: str, + resource_group_name: str, + service_name: str, + gateway_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2022-01-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/gateways/{gatewayName}') + 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'), + "gatewayName": _SERIALIZER.url("gateway_name", gateway_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: str, + resource_group_name: str, + service_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2022-01-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/gateways') + 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_validate_domain_request( + subscription_id: str, + resource_group_name: str, + service_name: str, + gateway_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2022-01-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/gateways/{gatewayName}/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'), + "gatewayName": _SERIALIZER.url("gateway_name", gateway_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, + json=json, + content=content, + **kwargs + ) + +class GatewaysOperations(object): + """GatewaysOperations 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.v2022_01_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: str, + service_name: str, + gateway_name: str, + **kwargs: Any + ) -> "_models.GatewayResource": + """Get the Spring Cloud Gateway 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 gateway_name: The name of Spring Cloud Gateway. + :type gateway_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: GatewayResource, or the result of cls(response) + :rtype: ~azure.mgmt.appplatform.v2022_01_01_preview.models.GatewayResource + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.GatewayResource"] + 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, + gateway_name=gateway_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('GatewayResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/gateways/{gatewayName}'} # type: ignore + + + def _create_or_update_initial( + self, + resource_group_name: str, + service_name: str, + gateway_name: str, + gateway_resource: "_models.GatewayResource", + **kwargs: Any + ) -> "_models.GatewayResource": + cls = kwargs.pop('cls', None) # type: ClsType["_models.GatewayResource"] + 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(gateway_resource, 'GatewayResource') + + request = build_create_or_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + gateway_name=gateway_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]: + 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('GatewayResource', pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize('GatewayResource', 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}/gateways/{gatewayName}'} # type: ignore + + + @distributed_trace + def begin_create_or_update( + self, + resource_group_name: str, + service_name: str, + gateway_name: str, + gateway_resource: "_models.GatewayResource", + **kwargs: Any + ) -> LROPoller["_models.GatewayResource"]: + """Create the default Spring Cloud Gateway or update the existing Spring Cloud Gateway. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. + :type resource_group_name: str + :param service_name: The name of the Service resource. + :type service_name: str + :param gateway_name: The name of Spring Cloud Gateway. + :type gateway_name: str + :param gateway_resource: The gateway for the create or update operation. + :type gateway_resource: ~azure.mgmt.appplatform.v2022_01_01_preview.models.GatewayResource + :keyword callable cls: A custom type or function that will be passed the direct response + :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 GatewayResource or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2022_01_01_preview.models.GatewayResource] + :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.GatewayResource"] + 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, + gateway_name=gateway_name, + gateway_resource=gateway_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('GatewayResource', 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}/gateways/{gatewayName}'} # type: ignore + + def _delete_initial( + self, + resource_group_name: str, + service_name: str, + gateway_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, + gateway_name=gateway_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}/gateways/{gatewayName}'} # type: ignore + + + @distributed_trace + def begin_delete( + self, + resource_group_name: str, + service_name: str, + gateway_name: str, + **kwargs: Any + ) -> LROPoller[None]: + """Disable the default Spring Cloud Gateway. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. + :type resource_group_name: str + :param service_name: The name of the Service resource. + :type service_name: str + :param gateway_name: The name of Spring Cloud Gateway. + :type gateway_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, + gateway_name=gateway_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}/gateways/{gatewayName}'} # type: ignore + + @distributed_trace + def list( + self, + resource_group_name: str, + service_name: str, + **kwargs: Any + ) -> Iterable["_models.GatewayResourceCollection"]: + """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 GatewayResourceCollection or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2022_01_01_preview.models.GatewayResourceCollection] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.GatewayResourceCollection"] + 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("GatewayResourceCollection", 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}/gateways'} # type: ignore + + @distributed_trace + def validate_domain( + self, + resource_group_name: str, + service_name: str, + gateway_name: str, + validate_payload: "_models.CustomDomainValidatePayload", + **kwargs: Any + ) -> "_models.CustomDomainValidateResult": + """Check the domains are 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 gateway_name: The name of Spring Cloud Gateway. + :type gateway_name: str + :param validate_payload: Custom domain payload to be validated. + :type validate_payload: + ~azure.mgmt.appplatform.v2022_01_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.v2022_01_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, + gateway_name=gateway_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}/gateways/{gatewayName}/validateDomain'} # type: ignore + diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_01_01_preview/operations/_monitoring_settings_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_01_01_preview/operations/_monitoring_settings_operations.py new file mode 100644 index 000000000000..a189ed0d133b --- /dev/null +++ b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_01_01_preview/operations/_monitoring_settings_operations.py @@ -0,0 +1,471 @@ +# 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 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 +T = TypeVar('T') +JSONType = Any +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_get_request( + subscription_id: str, + resource_group_name: str, + service_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2022-01-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: str, + resource_group_name: str, + service_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2022-01-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, + json=json, + content=content, + **kwargs + ) + + +def build_update_patch_request_initial( + subscription_id: str, + resource_group_name: str, + service_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2022-01-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, + json=json, + content=content, + **kwargs + ) + +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.v2022_01_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: 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.v2022_01_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: 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 = 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: str, + service_name: str, + monitoring_setting_resource: "_models.MonitoringSettingResource", + **kwargs: Any + ) -> 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.v2022_01_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.v2022_01_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: 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 = 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: str, + service_name: str, + monitoring_setting_resource: "_models.MonitoringSettingResource", + **kwargs: Any + ) -> 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.v2022_01_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.v2022_01_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/v2022_01_01_preview/operations/_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_01_01_preview/operations/_operations.py new file mode 100644 index 000000000000..0d758a21d203 --- /dev/null +++ b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_01_01_preview/operations/_operations.py @@ -0,0 +1,135 @@ +# 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, Iterable, Optional, TypeVar +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 +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_list_request( + **kwargs: Any +) -> HttpRequest: + api_version = "2022-01-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 + ) + +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.v2022_01_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: Any + ) -> 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.v2022_01_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/v2022_01_01_preview/operations/_runtime_versions_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_01_01_preview/operations/_runtime_versions_operations.py new file mode 100644 index 000000000000..0dafabaca178 --- /dev/null +++ b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_01_01_preview/operations/_runtime_versions_operations.py @@ -0,0 +1,114 @@ +# 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 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 +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_list_runtime_versions_request( + **kwargs: Any +) -> HttpRequest: + api_version = "2022-01-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 + ) + +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.v2022_01_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: 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.v2022_01_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/v2022_01_01_preview/operations/_service_registries_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_01_01_preview/operations/_service_registries_operations.py new file mode 100644 index 000000000000..0fe6bc05c341 --- /dev/null +++ b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_01_01_preview/operations/_service_registries_operations.py @@ -0,0 +1,547 @@ +# 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, Iterable, Optional, TypeVar, Union +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 +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_get_request( + subscription_id: str, + resource_group_name: str, + service_name: str, + service_registry_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2022-01-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/serviceRegistries/{serviceRegistryName}') + 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'), + "serviceRegistryName": _SERIALIZER.url("service_registry_name", service_registry_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: str, + resource_group_name: str, + service_name: str, + service_registry_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2022-01-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/serviceRegistries/{serviceRegistryName}') + 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'), + "serviceRegistryName": _SERIALIZER.url("service_registry_name", service_registry_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="PUT", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_delete_request_initial( + subscription_id: str, + resource_group_name: str, + service_name: str, + service_registry_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2022-01-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/serviceRegistries/{serviceRegistryName}') + 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'), + "serviceRegistryName": _SERIALIZER.url("service_registry_name", service_registry_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: str, + resource_group_name: str, + service_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2022-01-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/serviceRegistries') + 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 + ) + +class ServiceRegistriesOperations(object): + """ServiceRegistriesOperations 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.v2022_01_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: str, + service_name: str, + service_registry_name: str, + **kwargs: Any + ) -> "_models.ServiceRegistryResource": + """Get the Service Registry 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 service_registry_name: The name of Service Registry. + :type service_registry_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ServiceRegistryResource, or the result of cls(response) + :rtype: ~azure.mgmt.appplatform.v2022_01_01_preview.models.ServiceRegistryResource + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.ServiceRegistryResource"] + 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, + service_registry_name=service_registry_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('ServiceRegistryResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/serviceRegistries/{serviceRegistryName}'} # type: ignore + + + def _create_or_update_initial( + self, + resource_group_name: str, + service_name: str, + service_registry_name: str, + **kwargs: Any + ) -> "_models.ServiceRegistryResource": + cls = kwargs.pop('cls', None) # type: ClsType["_models.ServiceRegistryResource"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_create_or_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + service_registry_name=service_registry_name, + 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]: + 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('ServiceRegistryResource', pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize('ServiceRegistryResource', 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}/serviceRegistries/{serviceRegistryName}'} # type: ignore + + + @distributed_trace + def begin_create_or_update( + self, + resource_group_name: str, + service_name: str, + service_registry_name: str, + **kwargs: Any + ) -> LROPoller["_models.ServiceRegistryResource"]: + """Create the default Service Registry or update the existing Service Registry. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. + :type resource_group_name: str + :param service_name: The name of the Service resource. + :type service_name: str + :param service_registry_name: The name of Service Registry. + :type service_registry_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 ServiceRegistryResource or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2022_01_01_preview.models.ServiceRegistryResource] + :raises: ~azure.core.exceptions.HttpResponseError + """ + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.ServiceRegistryResource"] + 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, + service_registry_name=service_registry_name, + 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('ServiceRegistryResource', 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}/serviceRegistries/{serviceRegistryName}'} # type: ignore + + def _delete_initial( + self, + resource_group_name: str, + service_name: str, + service_registry_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, + service_registry_name=service_registry_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}/serviceRegistries/{serviceRegistryName}'} # type: ignore + + + @distributed_trace + def begin_delete( + self, + resource_group_name: str, + service_name: str, + service_registry_name: str, + **kwargs: Any + ) -> LROPoller[None]: + """Disable the default Service Registry. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. + :type resource_group_name: str + :param service_name: The name of the Service resource. + :type service_name: str + :param service_registry_name: The name of Service Registry. + :type service_registry_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, + service_registry_name=service_registry_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}/serviceRegistries/{serviceRegistryName}'} # type: ignore + + @distributed_trace + def list( + self, + resource_group_name: str, + service_name: str, + **kwargs: Any + ) -> Iterable["_models.ServiceRegistryResourceCollection"]: + """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 ServiceRegistryResourceCollection or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2022_01_01_preview.models.ServiceRegistryResourceCollection] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.ServiceRegistryResourceCollection"] + 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("ServiceRegistryResourceCollection", 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}/serviceRegistries'} # type: ignore diff --git a/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_01_01_preview/operations/_services_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_01_01_preview/operations/_services_operations.py new file mode 100644 index 000000000000..a92d3ab519c9 --- /dev/null +++ b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_01_01_preview/operations/_services_operations.py @@ -0,0 +1,1527 @@ +# 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, Iterable, Optional, TypeVar, Union +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 +T = TypeVar('T') +JSONType = Any +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_get_request( + subscription_id: str, + resource_group_name: str, + service_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2022-01-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: str, + resource_group_name: str, + service_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2022-01-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, + json=json, + content=content, + **kwargs + ) + + +def build_delete_request_initial( + subscription_id: str, + resource_group_name: str, + service_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2022-01-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: str, + resource_group_name: str, + service_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2022-01-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, + json=json, + content=content, + **kwargs + ) + + +def build_list_test_keys_request( + subscription_id: str, + resource_group_name: str, + service_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2022-01-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: str, + resource_group_name: str, + service_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2022-01-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, + json=json, + content=content, + **kwargs + ) + + +def build_disable_test_endpoint_request( + subscription_id: str, + resource_group_name: str, + service_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2022-01-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: str, + resource_group_name: str, + service_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2022-01-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: str, + resource_group_name: str, + service_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2022-01-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: str, + resource_group_name: str, + service_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2022-01-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: str, + location: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2022-01-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, + json=json, + content=content, + **kwargs + ) + + +def build_list_by_subscription_request( + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2022-01-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: str, + resource_group_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2022-01-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 + ) + +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.v2022_01_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: 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.v2022_01_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: 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 = 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: str, + service_name: str, + resource: "_models.ServiceResource", + **kwargs: Any + ) -> 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.v2022_01_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.v2022_01_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: 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 = 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}'} # type: ignore + + + @distributed_trace + def begin_delete( + self, + resource_group_name: str, + service_name: str, + **kwargs: Any + ) -> 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: 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 = 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: str, + service_name: str, + resource: "_models.ServiceResource", + **kwargs: Any + ) -> 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.v2022_01_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.v2022_01_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: 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.v2022_01_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: 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.v2022_01_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.v2022_01_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: 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 = 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: 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.v2022_01_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: 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 = 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: str, + service_name: str, + **kwargs: Any + ) -> 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: 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 = 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: str, + service_name: str, + **kwargs: Any + ) -> 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: 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.v2022_01_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.v2022_01_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: Any + ) -> 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.v2022_01_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: str, + **kwargs: Any + ) -> 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.v2022_01_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/v2022_01_01_preview/operations/_skus_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_01_01_preview/operations/_skus_operations.py new file mode 100644 index 000000000000..d2c93d9e5a6c --- /dev/null +++ b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_01_01_preview/operations/_skus_operations.py @@ -0,0 +1,144 @@ +# 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, Iterable, Optional, TypeVar +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 +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_list_request( + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2022-01-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 + ) + +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.v2022_01_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: Any + ) -> 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.v2022_01_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/v2022_01_01_preview/operations/_storages_operations.py b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_01_01_preview/operations/_storages_operations.py new file mode 100644 index 000000000000..13c963d56547 --- /dev/null +++ b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_01_01_preview/operations/_storages_operations.py @@ -0,0 +1,572 @@ +# 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, Iterable, Optional, TypeVar, Union +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 +T = TypeVar('T') +JSONType = Any +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_get_request( + subscription_id: str, + resource_group_name: str, + service_name: str, + storage_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2022-01-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: str, + resource_group_name: str, + service_name: str, + storage_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2022-01-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, + json=json, + content=content, + **kwargs + ) + + +def build_delete_request_initial( + subscription_id: str, + resource_group_name: str, + service_name: str, + storage_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2022-01-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: str, + resource_group_name: str, + service_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2022-01-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 + ) + +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.v2022_01_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: 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.v2022_01_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: 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 = 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: str, + service_name: str, + storage_name: str, + storage_resource: "_models.StorageResource", + **kwargs: Any + ) -> 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.v2022_01_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.v2022_01_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: 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 = 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: str, + service_name: str, + storage_name: str, + **kwargs: Any + ) -> 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: str, + service_name: str, + **kwargs: Any + ) -> 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.v2022_01_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/v2022_01_01_preview/py.typed b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_01_01_preview/py.typed new file mode 100644 index 000000000000..e5aff4f83af8 --- /dev/null +++ b/sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2022_01_01_preview/py.typed @@ -0,0 +1 @@ +# Marker file for PEP 561. \ No newline at end of file